Details
-
Bug
-
Resolution: Fixed
-
P3
-
6
-
b115
-
generic
-
generic
-
Verified
Description
URLClassLoader is not describes behavior of several methods in case null arguments.
This methods are:
public URLClassLoader(URL[] urls)
URLClassLoader(URL[] urls, ClassLoader parent)
URLClassLoader(URL[] urls, ClassLoader parent, URLStreamHandlerFactory factory)
protected void addURL(URL url)
protected Class<?> findClass(String name) throws ClassNotFoundException
protected Package definePackage(String name, Manifest man, URL url) throws IllegalArgumentException
public URL findResource(String name)
public Enumeration<URL> findResources(String name) throws IOException
protected PermissionCollection getPermissions(CodeSource codesource)
public static URLClassLoader newInstance(URL[] urls, ClassLoader parent)
public static URLClassLoader newInstance(URL[] urls)
From "Requirements for Writing Java API Specifications":
For each reference type argument, specify the behavior when null is passed in. If possible, document the general null argument behavior at the package or class level, such as causing a java.lang.NullPointerException to be thrown. Deviations from this behavior can then be documented at the method level.
See: http://java.sun.com/j2se/javadoc/writingapispecs/index.html#method
I'm searching for such documentations and found nothing. URLClassLoader itself, as well as methods documentation and package (java.net) documentation all hasn't such information.
So, we can assume that all methods will feel O.K. in case null argument(s). That most likely isn't true.
This methods are:
public URLClassLoader(URL[] urls)
URLClassLoader(URL[] urls, ClassLoader parent)
URLClassLoader(URL[] urls, ClassLoader parent, URLStreamHandlerFactory factory)
protected void addURL(URL url)
protected Class<?> findClass(String name) throws ClassNotFoundException
protected Package definePackage(String name, Manifest man, URL url) throws IllegalArgumentException
public URL findResource(String name)
public Enumeration<URL> findResources(String name) throws IOException
protected PermissionCollection getPermissions(CodeSource codesource)
public static URLClassLoader newInstance(URL[] urls, ClassLoader parent)
public static URLClassLoader newInstance(URL[] urls)
From "Requirements for Writing Java API Specifications":
For each reference type argument, specify the behavior when null is passed in. If possible, document the general null argument behavior at the package or class level, such as causing a java.lang.NullPointerException to be thrown. Deviations from this behavior can then be documented at the method level.
See: http://java.sun.com/j2se/javadoc/writingapispecs/index.html#method
I'm searching for such documentations and found nothing. URLClassLoader itself, as well as methods documentation and package (java.net) documentation all hasn't such information.
So, we can assume that all methods will feel O.K. in case null argument(s). That most likely isn't true.
Attachments
Issue Links
- relates to
-
JDK-7179567 JCK8 tests: api/java_net/URLClassLoader/index.html#Ctor3 failed with NPE
- Closed
-
JDK-8026517 URLClassLoader constructors and newInstance() should throw NPE if URL array has a null element
- Closed
-
JDK-6431651 No description for addURL(URL url) method of URLClassLoader class in case null url
- Closed