Issue Details (XML | Word | Printable)

Key: XBEAN-109
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Ivan
Reporter: Ingo Bormann
Votes: 0
Watchers: 0
Available Workflow Actions

Reopen Issue
Operations

If you were logged in you would be able to see more operations.
XBean

org.apache.xbean.classloader.JarFileClassLoader can not handle pathnames with containing spaces

Created: 01/Aug/08 04:15 PM   Updated: 22/Sep/09 03:49 PM
Return to search
Component/s: classloader
Affects Version/s: None
Fix Version/s: 3.6

Time Tracking:
Not Specified

File Attachments:
  Size
File Licensed for inclusion in ASF works xbean.diff 2008-08-01 04:26 PM Ingo Bormann 6 kB
Environment: jdk1.6, Windows 2000 Latest version from SVN

Resolution Date: 22/Sep/09 03:49 PM


 Description  « Hide
A lot of classes in the package org.apache.xbean.classloader use File.toURL() instead of File.toURI().toURL(). File.toURL() is deprecated and does not work on windows with pathnames containing spaces. If a pathname contains spaces then File.toURL() does not convert spaces correctly. Javadoc recommends to use File.toURI().toURL() instead.

I have a patched version where this is fixed for the full package org.apache.xbean.classloader.



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Ingo Bormann added a comment - 01/Aug/08 04:26 PM
This is a diff between the head of SVN and my modified version. You will find that File.toURL() is replaced by File.toURI().toURL() in a couple of places. Should not be too hard to apply.

Ingo Bormann made changes - 01/Aug/08 04:26 PM
Field Original Value New Value
Attachment xbean.diff [ 12387354 ]
Benjamin Bentmann added a comment - 14/Oct/08 10:58 AM - edited
+1 on the usage of File.toURI().toURL()

As for the replacement of new File(url.getPath()) with new File(url.toURI()): It might be wise to simply move the call new File(url.getPath()) into the catch for the URISyntaxException. This would increase robustness for the case where the input URL is not properly escaped.


Ivan made changes - 20/May/09 02:06 PM
Assignee Ivan [ xuhaihong ]
Ivan made changes - 20/May/09 02:07 PM
Status Open [ 1 ] In Progress [ 3 ]
Repository Revision Date User Message
ASF #776705 Wed May 20 14:09:47 UTC 2009 xuhaihong XBEAN-109 org.apache.xbean.classloader.JarFileClassLoader can not handle pathnames with containing spaces, thanks Ingo Bormann for the patch
Files Changed
MODIFY /geronimo/xbean/trunk/xbean-classloader/src/main/java/org/apache/xbean/classloader/UrlResourceFinder.java
MODIFY /geronimo/xbean/trunk/xbean-classloader/src/main/java/org/apache/xbean/classloader/DirectoryResourceHandle.java
MODIFY /geronimo/xbean/trunk/xbean-classloader/src/main/java/org/apache/xbean/classloader/JarFileUrlStreamHandler.java
MODIFY /geronimo/xbean/trunk/xbean-classloader/src/main/java/org/apache/xbean/classloader/DirectoryResourceLocation.java
MODIFY /geronimo/xbean/trunk/xbean-classloader/src/main/java/org/apache/xbean/classloader/JarFileUrlConnection.java

Ivan made changes - 20/May/09 02:12 PM
Status In Progress [ 3 ] Open [ 1 ]
Ivan added a comment - 20/May/09 02:13 PM
Merge the patch to XBean trunk at rev 776705. Thanks Ingo Bormann for the patch !

Ivan added a comment - 20/May/09 02:16 PM
Hi, just find that for XBean JIRAs, there is no "resolve" action. So for these JIRAs, shall I need to start a RTC view, then commit the patch files ?

David Jencks added a comment - 22/Sep/09 03:49 PM
I think we are just closing issues once they are fixed. Ideally we would make the jira options the same as the geronimo ones.

David Jencks made changes - 22/Sep/09 03:49 PM
Resolution Fixed [ 1 ]
Fix Version/s 3.6 [ 12313981 ]
Status Open [ 1 ] Closed [ 6 ]