Bugs item #676243, was opened at 2003-01-28 10:23
Message generated for change (Comment added) made by ssotangkur
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=676243&group_id=22866

Category: JBossServer
Group: v3.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Andrew Everitt (andieveritt)
Assigned to: Nobody/Anonymous (nobody)
Summary: FileURLConnection needs URL decode for JDK 1.4

Initial Comment:
In the constructor of
org.jboss.net.protocol.file.FileURLConnection a new
File is created from the supplied URL. In JDK 1.4 the
result of URL.getPath() is URL encoded which means on
windows with a path with a space you get
'C:\Program%20Files\foo\bar' - which doesn't work.
I have tested a modified version of FileURLConnection
which URL decodes the result. This resolves the issue.
I have attached the modified version. The only change
is on Line 45:
-       file = new File(url.getPath().replace('/',
File.separatorChar).replace('|', ':'));
+      file = new
File(java.net.URLDecoder.decode(url.getPath()).replace('/',
File.separatorChar).replace('|', ':'));


----------------------------------------------------------------------

Comment By: Sarit Sotangkur (ssotangkur)
Date: 2004-03-24 13:31

Message:
Logged In: YES 
user_id=1005716

This also seems to be an issue with JBoss 3.0.x. 
I found this when using the latest version of Xerces and try 
to startup JBoss-Jetty (installed in "Program Files\..."), you 
will get a similar error complaining about it not being able to 
find a file in "Program%20Files\...". Please merge whatever 
fixes you do into the 3.0.x branch.

I made a similar workaround in FileURLConnection by just 
converting '%20' back into a space ' ' before instantiating the 
File() object.

----------------------------------------------------------------------

Comment By: Andrew Everitt (andieveritt)
Date: 2003-02-28 00:54

Message:
Logged In: YES 
user_id=689882

I have now tracked down the route cause of this problem, it
is caused by inconsistency in the behaviour of java.net.URL.
See the following bug on the JDC which explains things at
great length:
http://developer.java.sun.com/developer/bugParade/bugs/4273532.ht
ml

I believe that my patch as proposed should be applied. I
have confirmed that it works well for me. The only situation
where the URL decode could cause a problem is when a path
contains a % or a + but wasn't previously URL encoded. Since
most file systems don't allow % in paths and + is unusual
the patch makes sense to me.


----------------------------------------------------------------------

Comment By: Andrew Everitt (andieveritt)
Date: 2003-02-20 06:55

Message:
Logged In: YES 
user_id=689882

OK, after some investigation it appears that this may not be
quite the correct fix! The problem is some apparent
inconsistency with when paths are getting URL encoded.
Somethings like:
URL url = new URL("file:///C:/Program Files/foo/bar");
Doesn't seem to get URL encoded and will work fine when
passed to FileURLConnection. However things like:
URL csurl =
Some.class.getProtectionDomain().getCodeSource().getLocation();
and
URL res = Some.class.getClassLoader().getResource("File in
path with space.txt");
returns a path that is URL encoded and so doesn't work when
a file is in a path with a space.

I guess that JBoss is using these calls to get URLs for
resources which then throw up later.

More to follow.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=676243&group_id=22866


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to