VM resource loading bug
"S. Meslin-Weber" <[email protected]> Wed, 22 Jun 2005 15:55:26 +0100
| Newsgroups | gmane.comp.java.classpath.devel,gmane.comp.java.vm.sablevm.general |
|---|---|
| Message-ID | <[email protected]> |
Hi guys, Forwarding this to the list as I've just tested with SableVM 1.11.3 and I get the same problem so this might be present in more VMs... ---- previous jamvm bug report ---- I have code that uses getClass().getResourceAsStream(name) in the bootclasspath (the named file exists). The bug causes classpath to try using the ftp provider to open the stream :) This bug shows up easily when looking for a resource outside of a jar... but I identified it first because it also showed before I expanded my jars. Here's a test case to make things easier to debug: mkdir testdir touch testdir/foo ./bin/jamvm -Xbootclasspath/p:testdir -cp . ResourceTest java.lang.IllegalArgumentException: address is unresolved: testdir:21 at gnu.java.net.PlainSocketImpl.connect (PlainSocketImpl.java:243) at java.net.Socket.connect (Socket.java:439) at java.net.Socket.connect (Socket.java:397) at gnu.java.net.protocol.ftp.FTPConnection.<init> (FTPConnection.java:253) at gnu.java.net.protocol.ftp.FTPConnection.<init> (FTPConnection.java:221) at gnu.java.net.protocol.ftp.FTPURLConnection.connect (FTPURLConnection.java:123) at gnu.java.net.protocol.ftp.FTPURLConnection.getInputStream (FTPURLConnection.java:167) at java.net.URL.openStream (URL.java:683) at java.lang.ClassLoader.getResourceAsStream (ClassLoader.java:711) at java.lang.Class.getResourceAsStream (Class.java:944) at ResourceTest.<init> (ResourceTest.java:7) at ResourceTest.main (ResourceTest.java:3) Cheers! Steph -- ================================================================ Stephane Meslin-Weber Email: [email protected] Senior Software Engineer Web: http://odonata.tangency.co.uk ================================================================ _______________________________________________ Classpath mailing list [email protected] http://lists.gnu.org/mailman/listinfo/classpath
ResourceTest.java
(text/x-java, 347 B)
public class ResourceTest {
public static void main(String[] args) {
new ResourceTest();
}
public ResourceTest() {
String name = "foo";
System.err.println("getResourceAsStream()=="+getClass().getResourceAsStream(name));
System.err.println("getSystemResourceAsStream()=="+ClassLoader.getSystemResourceAsStream(name));
}
}
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFCuXve5QGfd9PDUN0RArkVAJ9hk7LuoITh6wjozWdn/jtJQAj7cQCgsgOj WDZoxKrDcPoAT+sdPSm4ia8= =61oV -----END PGP SIGNATURE-----