On Thu, 28 Jul 2022 06:48:56 GMT, KIRIYAMA Takuya <d...@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.

I believe you are correct. Could you update the UriTest with some examples and 
counter-examples to validate this claim?

src/java.base/share/classes/java/net/URI.java line 225:

> 223:  * Let <i>u</i> be any normalized absolute URI ending with a slash 
> character ({@code '/'})
> 224:  * and <i>v</i> be any normalized relative URI not beginning with a 
> period character ({@code '.'})
> 225:  * or slash character ({@code '/'}). Then, the following statement is 
> true.

A colon ':' may be more appropriate than a period '.' at the end of this 
sentence:
I'd suggest:
> Then, the following statement is true:

src/java.base/share/classes/java/net/URI.java line 232:

> 230:  *
> 231:  * Let <i>u</i> be any normalized absolute URI ending with a slash 
> character ({@code '/'})
> 232:  * and <i>v</i> be any normalized absolute URI. Then, the following 
> statement is true.

Same remark here.

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

Changes requested by dfuchs (Reviewer).

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

Reply via email to