RFR 8215008: Clear confusion between URL/URI paths and file system paths

Daniel Fuchs daniel.fuchs at oracle.com
Tue Dec 11 11:27:53 UTC 2018


Hi Martin,

Thanks for pointing that out.
I have logged https://bugs.openjdk.java.net/browse/JDK-8215207

best regards,

-- daniel

On 10/12/2018 19:41, Martin Buchholz wrote:
> Thanks.  Looks good.
> 
> Tangentially ... I see URLClassLoader uses URLClassPath which uses 
> FileURLMapper, which tries to directly convert a URL to a String path.
> FileURLMapper uses URL#getFile, and TIL that #getFile differs from 
> #getPath in that it also returns a query component where present.
> Maybe FileURLMapper should check explicitly that the URL's query and 
> anchor components are empty (etc ...)?
> Maybe an audit should be done to ensure that openjdk itself follows the 
> guidelines?
> Maybe that would turn up additional API methods for users that would be 
> good to add?
> 
> On Mon, Dec 10, 2018 at 9:54 AM Daniel Fuchs <daniel.fuchs at oracle.com 
> <mailto:daniel.fuchs at oracle.com>> wrote:
> 
>     Hi Alan,
> 
>     Here is an updated webrev that takes into account
>     your later feedback:
> 
>     http://cr.openjdk.java.net/~dfuchs/webrev_8215008/webrev.02/
>     <http://cr.openjdk.java.net/%7Edfuchs/webrev_8215008/webrev.02/>
> 
>     best regards,
> 
>     -- daniel
> 
>     On 07/12/2018 16:16, Daniel Fuchs wrote:
>      > Thanks for the feedback Alan!
>      >
>      > I have updated the webrev accordingly:
>      >
>      > http://cr.openjdk.java.net/~dfuchs/webrev_8215008/webrev.01/
>     <http://cr.openjdk.java.net/%7Edfuchs/webrev_8215008/webrev.01/>
>      >
>      > best regards,
>      >
>      > -- daniel
>      >
>      > On 07/12/2018 15:20, Alan Bateman wrote:
>      >> I've come across dozens of cases where code has been trying to
>     use a
>      >> URL path as a file path so an API note is a good idea. On the
>     wording
>      >> then "there is not necessarily any direct relationship ..." is a
>     bit
>      >> confusing to read, at least for file URIs where the file path is
>      >> encoded as a URI. I also think it would be useful to link to the
>     APIs
>      >> that do the encoding/decoding, as in File(URI), File::toURI,
>      >> Path.of(URI), Path::toUri.
>      >> On 07/12/2018 15:13, Daniel Fuchs wrote:
>      >> Please find below a fix for
>      >> 8215008: Clear confusion between URL/URI paths and file system paths
>      >> https://bugs.openjdk.java.net/browse/JDK-8215008
>      >>
>      >> It adds a small non normative @apiNote to java.net.URL and
>     java.net.URI.
> 



More information about the net-dev mailing list