You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "David Blevins (JIRA)" <ji...@apache.org> on 2010/04/05 05:23:27 UTC

[jira] Reopened: (OPENEJB-1252) URL->File decoding should avoid "+" in paths

     [ https://issues.apache.org/jira/browse/OPENEJB-1252?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Blevins reopened OPENEJB-1252:
------------------------------------

      Assignee: David Jencks  (was: David Blevins)

I just wish the VM would offer a symmetrical method to file.toURL().  There really should be a url.toFile() method even if it throws an exception for all URL schemes except "file:".  The trick is a URL can't always be converted to a URI.

This will fail:

    URL url = new URL("file://some file.txt");
    new File(url.toURI().getPath());

As will this:

    new File("some file.txt").toURL().toURI();

Happy to let some else deal with this one.  So far I haven't found a solution that doesn't make another scenario fail.  The harmony code was the best I could come up with.

> URL->File decoding should avoid "+" in paths
> --------------------------------------------
>
>                 Key: OPENEJB-1252
>                 URL: https://issues.apache.org/jira/browse/OPENEJB-1252
>             Project: OpenEJB
>          Issue Type: Bug
>    Affects Versions: 3.1.3
>            Reporter: David Jencks
>            Assignee: David Jencks
>             Fix For: 3.1.3
>
>
> URLS tries to use URLDecoder on a file path.  This converts the "+" characters mac os x likes to put in temp file names into " " (space) which causes disasters.  The javadoc says its not for paths, just form content encoded in a url.
> Use URI.create instead.

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