Integrated: 8051627: Invariants about java.net.URI resolve and relativize are wrong

KIRIYAMA Takuya duke at openjdk.org
Thu Nov 24 16:19:39 UTC 2022


On Thu, 28 Jul 2022 06:48:56 GMT, KIRIYAMA Takuya <duke at openjdk.org> wrote:

> 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.

This pull request has now been integrated.

Changeset: ab1f9ffa
Author:    KIRIYAMA Takuya <kiriyama.takuya at fujitsu.com>
Committer: Daniel Fuchs <dfuchs at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/ab1f9ffa78ca95b67b6d57936a70c49abf18fd00
Stats:     57 lines in 2 files changed: 52 ins; 0 del; 5 mod

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

Reviewed-by: dfuchs

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

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


More information about the net-dev mailing list