A getResource() on a resource in CLASSPATH yields a URL whose getHost() returns null. This breaks hashCode() [which should know better, imho].
Reproduce as follows:
calterra% cat Test.java
import java.net.*;
public class Test {
public static void main(String args[]) {
URL u = ClassLoader.getSystemResource("Test.java");
System.err.println("url: "+u);
if (u!=null) {
int i = u.hashCode();
System.err.println("hash: "+i);
}
}
}
===
calterra% which java
/usr/local/java/jdk-pumpkin/solaris/bin/java
calterra% javac Test.java
calterra% java Test
url: systemresource:/FILE0/+/Test.java
java.lang.NullPointerException
at java.net.URL.hashCode(URL.java)
at Test.main(Test.java:8)
===
calterra% setenv PATH $PATHe
calterra% which java
/export/home2/pelegri/jdk-pumpkin/build/bin/java
calterra% javac Test.java
calterra% java Test
SystemResource.parseURL(); host is:
url: systemresource:/FILE0/+/Test.java
hash: 1274556635
==============
pelegri@Eng 1997-11-03
Reproduce as follows:
calterra% cat Test.java
import java.net.*;
public class Test {
public static void main(String args[]) {
URL u = ClassLoader.getSystemResource("Test.java");
System.err.println("url: "+u);
if (u!=null) {
int i = u.hashCode();
System.err.println("hash: "+i);
}
}
}
===
calterra% which java
/usr/local/java/jdk-pumpkin/solaris/bin/java
calterra% javac Test.java
calterra% java Test
url: systemresource:/FILE0/+/Test.java
java.lang.NullPointerException
at java.net.URL.hashCode(URL.java)
at Test.main(Test.java:8)
===
calterra% setenv PATH $PATHe
calterra% which java
/export/home2/pelegri/jdk-pumpkin/build/bin/java
calterra% javac Test.java
calterra% java Test
SystemResource.parseURL(); host is:
url: systemresource:/FILE0/+/Test.java
hash: 1274556635
==============
pelegri@Eng 1997-11-03