FULL PRODUCT VERSION :
A DESCRIPTION OF THE PROBLEM :
java.net.URI promises that new URI(u.toString()).equals(u), but doesn't escape colons in paths. A path in a URI reference without a slash will be treated as an absolute URL when it is re-parsed.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Construct a URI reference with a path containing an unescaped colon and no leading slash. Round-trip it via a String and observe that it's different to the original URI.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
true
./a:b
or
a%3Ab
ACTUAL -
false
a:b
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
URI orig = new URI(null, null, " /a:b " , null);
URI u = new URI( " . " ).relativize(orig);
System.out.println(new URI(u.toString()).equals(u));
System.out.println(u);
---------- END SOURCE ----------
A DESCRIPTION OF THE PROBLEM :
java.net.URI promises that new URI(u.toString()).equals(u), but doesn't escape colons in paths. A path in a URI reference without a slash will be treated as an absolute URL when it is re-parsed.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Construct a URI reference with a path containing an unescaped colon and no leading slash. Round-trip it via a String and observe that it's different to the original URI.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
true
./a:b
or
a%3Ab
ACTUAL -
false
a:b
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
URI orig = new URI(null, null, " /a:b " , null);
URI u = new URI( " . " ).relativize(orig);
System.out.println(new URI(u.toString()).equals(u));
System.out.println(u);
---------- END SOURCE ----------