Article View: borland.public.jbuilder.java.api
Article #2693Trouble with file:// protocol handling in Sun JDK 1.2.2
From: Andrey Zakharchook
Date: Wed, 07 Jun 2000 00:00
Date: Wed, 07 Jun 2000 00:00
24 lines
1243 bytes
1243 bytes
Hello, all! I have trouble with following source code: ... URL url = new URL(fileName); URLConnection connection = url.openConnection(); connection.connect(); InputStream inputStream = connection.getInputStream(); ... When I pass as fileName string like a "file:\\\\C:\\filename.txt" all works OK under MS JVM and IBM JDK 1.1.8, but under Sun JDK 1.1.2 I've got UnknownHostException, because under MS and IBM JVMs connection is instance of sun.net.www.protocol.file.FileURLConnection class and under Sun it is sun.net.www.protocol.ftp.FtpURLConnection. So, if I'm not mistaken, Sun handles file:// protocol as FTP, but it isn't correct, eh? And can anyone of all give me some hint how can I write really portable code in this case. Thanks, Andrey.
Technical Details
Message-ID:
<393e2049@dnews>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,45a89284763b95e6,start X-Google-Attributes: gid1089d0,public From: "Andrey Zakharchook" <coder@mailroom.com> Subject: Trouble with file:// protocol handling in Sun JDK 1.2.2 Date: 2000/06/07 Message-ID: <393e2049@dnews> X-Deja-AN: 632107120 X-Trace: 7 Jun 2000 03:13:29 -0800, 212.113.39.21 Newsgroups: borland.public.jbuilder.java.api X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3