Re: RFR: 8272702: Resolving URI relative path with no / may lead to incorrect toString [v2]
On Wed, 1 Jun 2022 14:15:31 GMT, Daniel Fuchs 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
Re: RFR: 8272702: Resolving URI relative path with no / may lead to incorrect toString [v2]
> Consider an authority component without trailing "/" as a base URI. When > resolving a relative path against this base URI, the resulting URI is a > concatenated URI without "/". > This behaviour should be fixed, which is rationalized by > rfc3986#section-5.2.3. > Could you review this fix? 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 - Changes: - all: https://git.openjdk.java.net/jdk/pull/8899/files - new: https://git.openjdk.java.net/jdk/pull/8899/files/4bed962e..4d191430 Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk=8899=01 - incr: https://webrevs.openjdk.java.net/?repo=jdk=8899=00-01 Stats: 6 lines in 2 files changed: 5 ins; 0 del; 1 mod Patch: https://git.openjdk.java.net/jdk/pull/8899.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/8899/head:pull/8899 PR: https://git.openjdk.java.net/jdk/pull/8899
Re: RFR: 8272702: Resolving URI relative path with no / may lead to incorrect toString
On Thu, 26 May 2022 09:18:56 GMT, KIRIYAMA Takuya wrote: > Consider an authority component without trailing "/" as a base URI. When > resolving a relative path against this base URI, the resulting URI is a > concatenated URI without "/". > This behaviour should be fixed, which is rationalized by > rfc3986#section-5.2.3. > Could you review this fix? Changes requested by dfuchs (Reviewer). 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"` - PR: https://git.openjdk.java.net/jdk/pull/8899
Re: RFR: 8272702: Resolving URI relative path with no / may lead to incorrect toString
On Thu, 26 May 2022 12:00:37 GMT, Alexey Ivanov wrote: > You're using the wrong bugid. > [JDK-8272707](https://bugs.openjdk.java.net/browse/JDK-8272707) has nothing > to do with URI. Please use the correct bugid. I'm sorry, I made a mistake. JDK-8272702 is correct. I fixed it. - PR: https://git.openjdk.java.net/jdk/pull/8899