The current documentation of URI class describes relationship between resolve 
and relativize methods as follows.


For any two normalized URIs u and v,
    u.relativize(u.resolve(v)).equals(v) and
    u.resolve(u.relativize(v)).equals(v) .


However, there are some cases where this relationship is not true. For example, 
when u and v are "http://a/b"; and "c/d", respectively, both 
u.relativize(u.resolve(v)) and u.resolve(u.relativize(v)) equal to 
"http://a/c/d"; not "c/d". The documentation should be updated to avoid 
confusion by describing the relationship between resolve nd relativize methods 
under certain conditions of the URI. Note that these conditions are sufficient 
but not necessary for the statement.

-------------

Commit messages:
 - 8051627: Invariants about java.net.URI resolve and relativize are wrong
 - 8051627: Invariants about java.net.URI resolve and relativize are wrong

Changes: https://git.openjdk.org/jdk/pull/9671/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=9671&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8051627
  Stats: 12 lines in 1 file changed: 8 ins; 0 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/9671.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/9671/head:pull/9671

PR: https://git.openjdk.org/jdk/pull/9671

Reply via email to