On Wed, 1 Jun 2022 14:15:31 GMT, Daniel Fuchs <[email protected]> wrote:
>> KIRIYAMA Takuya has updated the pull request incrementally with one
>> additional commit since the last revision:
>>
>> 8272702: Resolving URI relative path with no / may lead to incorrect
>> toString
>
> src/java.base/share/classes/java/net/URI.java line 2140:
>
>> 2138: } else {
>> 2139: sb.append("/");
>> 2140: }
>
> This is wrong as it will cause
> `URI.create("foo").resolve(URI.create("test"))` to return `"/test"` instead
> of `"test"`
Your comment is correct. The behavior of specifying a relative URI as the base
URI should not change, although rfc2396 recommended that the base URI be an
absolute URI.
I modified to add "/" only if the given base URI is an absolute URI.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8899