Name: nt126004 Date: 09/11/2001
java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-root-
010613-02:07)
Java HotSpot(TM) Client VM (build 1.3.1, mixed mode)
Opening a connection to a file: URL with a host specified inexplicably tries
to do an anonymous ftp.
public class FtpTest {
public static void main(String [] args) {
try {
URL u = new URL( "file://abc/def" );
URLConnection c = u.openConnection();
System.err.println( c );
} catch (Exception e) { e.printStackTrace(); }
}
}
produces
sun.net.www.protocol.ftp.FtpURLConnection:ftp://abc/def
Why would it do that? I cannot find anything in the spec that indicates it
would do that. But even if this is intended (albeit undocumented) behavior,
what is the reasoning there? The likelihood that we would be able to find
the file through anonymous ftp at the path given for the file: protocol is
essentially zero. In fact, if we find something, it's likely NOT the file we
want. (example: file://somehost/etc/group would translate into ftp://
somehost/etc/group with user anonymous, which likely maps onto
something like file://somehost/users/ftp/etc/group in the real world
because of the anonymous ftp sandbox). Why not simply throw a nice
exception if we can't access the file using the file: protocol, and leave it to
the application to deal with, just like we'd do that with http, ftp and all the
other protocols?
(Review ID: 131632)
======================================================================
- relates to
-
JDK-6278334 (rb) SAP J2EE engine can not start with mustang b38
-
- Resolved
-