United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4671171 : UNC handling with file URLs broken (was: ConnectionRefused with relative path)

Details
Type:
Bug
Submit Date:
2002-04-19
Status:
Resolved
Updated Date:
2002-09-26
Project Name:
JDK
Resolved Date:
2002-09-26
Component:
core-libs
OS:
windows_98,windows_2000
Sub-Component:
java.net
CPU:
x86
Priority:
P4
Resolution:
Fixed
Affected Versions:
1.4.0,1.4.1
Fixed Versions:
1.4.2 (mantis)

Related Reports
Duplicate:
Duplicate:
Relates:

Sub Tasks

Description

Name: gm110360			Date: 04/18/2002


FULL PRODUCT VERSION :
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)

FULL OPERATING SYSTEM VERSION :
Microsoft Windows 2000 [Version 5.00.2195]


A DESCRIPTION OF THE PROBLEM :
I?m parsing xml files (method parse(File f, HandlerBase hb)
in class SAXParser). With a JFileChooser i am choosing the
files which i want to parse.

When i?m choosing files with absolute paths (e.g.
L:/dummy.xml), the parsing went perfect.
When i?m choosing files with relative paths
(e.g. //10.50.40.118/develop/dummy.xml,
where //10.50.40.118/develop is a server within a local
network connected as L: in my system), i get a
ConnectionException (java.net.ConnectionException:
Connection refused: connect).
I also tried to define the server in the hosts file, but
without success.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create a file object with relative path to an xml file
on a server in a local network
2. Try to parse the xml file

EXPECTED VERSUS ACTUAL BEHAVIOR :
After calling the parse(File f, HandlerBase hb) method in
Class SAXParser, a ConnectionException
(java.net.ConnectionException: Connection refused: connect)
will appear.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.net.ConnectException: Connection refused: connect
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:296)
	at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:162)
	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:149)
	at java.net.Socket.connect(Socket.java:430)
	at java.net.Socket.connect(Socket.java:379)
	at sun.net.NetworkClient.doConnect(NetworkClient.java:142)
	at sun.net.NetworkClient.openServer(NetworkClient.java:121)
	at sun.net.ftp.FtpClient.openServer(FtpClient.java:390)
	at sun.net.ftp.FtpClient.<init>(FtpClient.java:654)
	at sun.net.www.protocol.ftp.FtpURLConnection.connect
(FtpURLConnection.java:178)
	at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream
(FtpURLConnection.java:260)
	at java.net.URL.openStream(URL.java:956)



This bug can be reproduced always.

---------- BEGIN SOURCE ----------
//Server "\\10.50.40.118\develop" connected as L:
File correctFile = new File("L:\dummy.xml");
File wrongFile = new File("\\10.50.40.118\develop\dummy.xml");

DefaultHandler handler = new MyHandler();
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser saxParser = factory.newSAXParser();

saxParser.parse(correctFile, handler); //File will be parsed correct.
saxParser.parse(wrongFile, handler); //Exception will appear.
---------- END SOURCE ----------
(Review ID: 145576) 
======================================================================

                                    

Comments
EVALUATION


The XML parser appears to open a connection to 
file://10.50.40.118/develop/dummy.xml. As the URL has an authority
component it means that the resource is to be accessed over the
network. There isn't a standard for accessing file resources over 
the Internet (see section 3.10 of RFC 1738).

Our implementation first tries to check the existance of the resource 
as a UNC - in this case it's probably \\10.50.40.118\develop\dummy.xml
and if that fails it tries ftp. Unfortunately it seems that the UNC
checking is broken in 1.4.0. 

###@###.### 2002-04-19
                                     
2002-04-19
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
mantis

FIXED IN:
mantis

INTEGRATED IN:
mantis
mantis-b03


                                     
2004-06-14



Hardware and Software, Engineered to Work Together