RFR: JDK-8022748 (new URI(u.toString()).equals(u), does not hold with paths containing colons

Sebastian Sickelmann sebastian.sickelmann at gmx.de
Tue Oct 27 04:24:38 UTC 2015


Hi,

i investigated the problem described in JDK-8022748[1] i found that
the parser needed to be rescued for confusion while handling relative URIs.

A URI created through the relativize-method is schemaless and so it
need to handle the special-case (a colon in the path-element). While
there is also another way to handle it (encode the colon as %3A) i think
we should not choose to encode everything. First it would introduce another
style of special-case handling of a colon in the path (see the method
maybeAddLeadingDot which is used while normalizing) and when resolving
it back we would need to decode it back or leave it the encoded way which
is not suggest by RFC2396 section "1.5 URI Transcribability".

Also in Section 5 of RFC2396 it is suggested to rescue a colon in the
path-element in a relative URI through prepending a "./" just like in
maybeAddLeadingDot.

I am not sure if it is worth to refactor the split(),join(),normalize()
methods to provide a reusable colon-detection and -handling.

So, instead of split/join/normalize please find my webrev with a
simpler approach at:

http://cr.openjdk.java.net/~sebastian/8022748/webrev.00/

 -- Sebastian
[1] https://bugs.openjdk.java.net/browse/JDK-8022748


More information about the net-dev mailing list