jdk icon indicating copy to clipboard operation
jdk copied to clipboard

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

Open tkiriyama opened this issue 2 years ago • 8 comments

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.


Progress

  • [ ] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • [x] Change must not contain extraneous whitespace
  • [x] Commit message must refer to an issue
  • [ ] Change requires a CSR request to be approved

Issues

  • JDK-8051627: Invariants about java.net.URI resolve and relativize are wrong
  • JDK-8291462: Invariants about java.net.URI resolve and relativize are wrong (CSR)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/9671/head:pull/9671
$ git checkout pull/9671

Update a local copy of the PR:
$ git checkout pull/9671
$ git pull https://git.openjdk.org/jdk pull/9671/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 9671

View PR using the GUI difftool:
$ git pr show -t 9671

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/9671.diff

tkiriyama avatar Jul 28 '22 06:07 tkiriyama

/csr

tkiriyama avatar Jul 28 '22 06:07 tkiriyama

:wave: Welcome back tkiriyama! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

bridgekeeper[bot] avatar Jul 28 '22 06:07 bridgekeeper[bot]

@tkiriyama an approved CSR request is already required for this pull request.

openjdk[bot] avatar Jul 28 '22 06:07 openjdk[bot]

@tkiriyama The following label will be automatically applied to this pull request:

  • net

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

openjdk[bot] avatar Jul 28 '22 06:07 openjdk[bot]

Webrevs

mlbridge[bot] avatar Jul 29 '22 06:07 mlbridge[bot]

Could anyone please reviwe this fix?

tkiriyama avatar Aug 07 '22 23:08 tkiriyama

/csr needed

dfuch avatar Aug 11 '22 14:08 dfuch

@dfuch an approved CSR request is already required for this pull request.

openjdk[bot] avatar Aug 11 '22 14:08 openjdk[bot]

@tkiriyama This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

bridgekeeper[bot] avatar Sep 08 '22 20:09 bridgekeeper[bot]

@dfuch Thank you for your review and suggestions.

A colon ':' may be more appropriate than a period '.' at the end of this sentence: I'd suggest:

You’re right. I changed to use a colon.

Could you update the UriTest with some examples and counter-examples to validate this claim?

I added tests in URI/Test.java.
The tests include testing if the resolve-relativize relationship stand when the two URIs meet the condition of the modified javadoc.
The tests also include testing if the relationship does not stand when the two specific URIs which meets the condition of the original javadoc are given. These URIs are excluded by the condition of the modiied javadoc.

tkiriyama avatar Sep 16 '22 07:09 tkiriyama

Hi @tkiriyama sorry for taking so long to get back to you. I had a look at the CSR - and fixed a few missing fields, and added myself as reviewer. Please move its state to "Proposed" to get this moving further.

dfuch avatar Sep 28 '22 11:09 dfuch

@dfuch Thank you for your reply. I moved CSR's status to "PROPOSED". Please review it.

tkiriyama avatar Sep 29 '22 07:09 tkiriyama

@tkiriyama This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

bridgekeeper[bot] avatar Oct 27 '22 17:10 bridgekeeper[bot]

This pull request is waiting for the CSR.

tkiriyama avatar Nov 01 '22 04:11 tkiriyama

@dfuch The CSR of this pull request was moved to "CLOSED".
Could you review this pull request again?

tkiriyama avatar Nov 24 '22 04:11 tkiriyama

Done! Thanks for reminding me.

dfuch avatar Nov 24 '22 11:11 dfuch

@tkiriyama This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

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

Reviewed-by: dfuchs

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 979 new commits pushed to the master branch:

  • 3c4d5204ff96280b123f42a8cfbaef308e470b69: 8296671: [JFR] jdk.ContainerConfiguration event should include host total memory
  • 8b7397064b5b492b03bc8363f6ba74c70ce7d4a0: 8296208: AArch64: Enable SHA512 intrinsic by default on supported hardware
  • f4cf7589c0fa727ad091469c00e4dedbf9e0699e: 8297491: Loom: Stack chunks allocation code uses TLABs even when TLABs are disabled
  • 5e5b774bfb219bfa4a4f18cfaaf279a994779ee6: 8296768: Use different explicit claim marks for CLDs in Parallel and Serial GC
  • 9c77e41b81ebd28bd92ea7adad605981a5519046: 8297445: PPC64: Represent Registers as values
  • 2f8a5c2eca0dc3dad08b7b2c33394ac214907008: 8297480: GetPrimitiveArrayCritical in imageioJPEG misses result - NULL check
  • abeddab991d71f4ea54665082ffcb284267d7f44: 6528710: sRGB-ColorSpace to sRGB-ColorSpace Conversion
  • 09ac9eb5638400c840c3c31f022d4737b41761b1: 8297533: ProblemList java/io/File/TempDirDoesNotExist.java test failing on windows-x64
  • 53251454df5004ac9eac6799db9b9640277bee05: 8297529: ProblemList javax/swing/JFileChooser/8046391/bug8046391.java on windows-x64
  • 91cd8a03666d5c09c951b439d7d94b79933d97f6: 8297525: jdk/jshell/ToolBasicTest.java fails after JDK-8295984
  • ... and 969 more: https://git.openjdk.org/jdk/compare/9d6b0285f53599816c30393b87d16772ef6314b7...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@dfuch) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

openjdk[bot] avatar Nov 24 '22 11:11 openjdk[bot]

If you need a sponsor please drop a note here after integrating.

dfuch avatar Nov 24 '22 11:11 dfuch

/integrate

tkiriyama avatar Nov 24 '22 12:11 tkiriyama

@tkiriyama Your change (at version a5bb23cbda5f28781addf29c313ad51624a13efe) is now ready to be sponsored by a Committer.

openjdk[bot] avatar Nov 24 '22 12:11 openjdk[bot]

Thank you for your review. Could you sponsor this pull request, please?

tkiriyama avatar Nov 24 '22 12:11 tkiriyama

/sponsor

dfuch avatar Nov 24 '22 16:11 dfuch

Going to push as commit ab1f9ffa78ca95b67b6d57936a70c49abf18fd00. Since your change was applied there have been 982 commits pushed to the master branch:

  • df6cf1e41d0fc2dd5f5c094f66c7c8969cf5548d: 8296886: Fix various include sort order issues
  • 5e196b4b8e623107424e2fb54672790fd925fe73: 8297476: Increase InlineSmallCode default from 1000 to 2500 for RISC-V
  • 070a84cbae2f79def1c1eb65456c76f708f2e6e5: 8297192: Warning generating API docs for javax.management.MBeanServer: overridden methods do not document exception type
  • 3c4d5204ff96280b123f42a8cfbaef308e470b69: 8296671: [JFR] jdk.ContainerConfiguration event should include host total memory
  • 8b7397064b5b492b03bc8363f6ba74c70ce7d4a0: 8296208: AArch64: Enable SHA512 intrinsic by default on supported hardware
  • f4cf7589c0fa727ad091469c00e4dedbf9e0699e: 8297491: Loom: Stack chunks allocation code uses TLABs even when TLABs are disabled
  • 5e5b774bfb219bfa4a4f18cfaaf279a994779ee6: 8296768: Use different explicit claim marks for CLDs in Parallel and Serial GC
  • 9c77e41b81ebd28bd92ea7adad605981a5519046: 8297445: PPC64: Represent Registers as values
  • 2f8a5c2eca0dc3dad08b7b2c33394ac214907008: 8297480: GetPrimitiveArrayCritical in imageioJPEG misses result - NULL check
  • abeddab991d71f4ea54665082ffcb284267d7f44: 6528710: sRGB-ColorSpace to sRGB-ColorSpace Conversion
  • ... and 972 more: https://git.openjdk.org/jdk/compare/9d6b0285f53599816c30393b87d16772ef6314b7...master

Your commit was automatically rebased without conflicts.

openjdk[bot] avatar Nov 24 '22 16:11 openjdk[bot]

@dfuch @tkiriyama Pushed as commit ab1f9ffa78ca95b67b6d57936a70c49abf18fd00.

:bulb: You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

openjdk[bot] avatar Nov 24 '22 16:11 openjdk[bot]