-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
1.1.8
-
sparc
-
solaris_2.5
Name: mgC56079 Date: 05/26/99
JLS for Class.getResource(String name) says :
----------------------
Finds a resource with a given name. This method returns null if no resource with this name is found. The
rules for searching resources associated with a given class are implemented by the * defining class
loader of the class.
----------------------
null is not a object, it is not a 'name' for anything and it is expected that
call getResource((String)null)) will throw NullPointerException or return null.
But this call returns valid URL without any exceptions. If it is correct behavour
it should be reflected in documentation
Note that when you call .getContent method on this URL, you get null on win32
and InputStream on solaris
----------------------Test.java
public class Test {
public static void main(String[] args) throws java.io.IOException {
java.net.URL url = new Test().getClass().getResource((String)null);
System.out.println(""+url);
System.out.println(""+url.getContent());
}
}
----------------------Output on solaris
systemresource:/FILE0/+/
java.io.BufferedInputStream@1dc6094d
----------------------Output on win32
systemresource:/FILE0/+/
null
----------------------
======================================================================