geronimo-xbean-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benjamin Bentmann (JIRA)" <>
Subject [jira] Issue Comment Edited: (XBEAN-109) org.apache.xbean.classloader.JarFileClassLoader can not handle pathnames with containing spaces
Date Tue, 14 Oct 2008 11:05:44 GMT


bentmann edited comment on XBEAN-109 at 10/14/08 4:04 AM:

+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.

      was (Author: bentmann):
    +1 on the usage of {{File.toURI().toURL()}}

-1 on the replacement of {{new File(url.toURI())}} with {{new File(url.getPath())}}. {{URL.getPath()}}
merely returns a substring of the URL and as such can still contain percent-encoded characters.
Therefore, {{new File(url.getPath())}} should only be used as a fallback in case the URISyntaxException
indicates an unescaped URL.
>  org.apache.xbean.classloader.JarFileClassLoader can not handle pathnames with containing
> ------------------------------------------------------------------------------------------------
>                 Key: XBEAN-109
>                 URL:
>             Project: XBean
>          Issue Type: Bug
>          Components: classloader
>         Environment: jdk1.6, Windows 2000 Latest version from SVN
>            Reporter: Ingo Bormann
>         Attachments: xbean.diff
> 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.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message