Bugs item #676243, was opened at 2003-01-28 18:23 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: Andrew Everitt (andieveritt) Date: 2003-02-28 08: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 14: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:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development