8294948: Document IllegalArgumentException and NullPointerException thrown by URLStreamHandler::parseURL and URLStreamHandler::setURL#10609
Conversation
|
👋 Welcome back dfuchs! A progress list of the required criteria for merging this PR into |
|
/csr needed |
|
@dfuch this pull request will not be integrated until the CSR request JDK-8294984 for issue JDK-8294948 has been approved. |
Webrevs
|
|
Hello Daniel, the change looks fine to me and it does indeed document what is already being thrown from those methods currently. |
AlekseiEfimov
left a comment
There was a problem hiding this comment.
New documentation looks good to me, and matches the source code.
| * URLStreamHandler#parseURL(URL, String, int, int) parseURL method} is | ||
| * called during URL construction and it throws {@code IllegalArgumentException}. | ||
| * However, which checks are performed is implementation dependent, and | ||
| * callers should not rely on such checks for full URL validation. |
There was a problem hiding this comment.
I think the API note will need a few adjustments.
The first sentence uses the word "additionally" but the text prior to that isn't about throwing exceptions. I think what you mean is in addition to the reasons specified by the URL constructors, in which case this makes it normative. Maybe you could lend on the text "parsed URL fails to comply ..." or if that is too complicated then just drop this part of the API note.
A second sentence uses "In particular when ..." but I don't think URL specifies that it calls the parseURL method. If the URL constructors did specify this when you could reference it here. If you map to document the mapping of ISE to MalformedURLException then I think the URL constructors will need to document that they delegate to parseURL and throw MalformedURLException if the parsing fails with IAE.
There was a problem hiding this comment.
Thanks @AlanBateman - I have updated the API note, added an @implSpec in two of the constructors to spell out that they are calling the stream handler's parseURL method (the first one says it's equivalent to the second one so I don't think @implSpec is needed there), and improved the @throws MalformedURLException with more details.
Does the new text match your expectations?
| * | ||
| * @implSpec Parsing the URL involves calling the {@link | ||
| * URLStreamHandler#parseURL(URL, String, int, int) parseURL} method on the | ||
| * selected handler. |
There was a problem hiding this comment.
What you would think about making this more direct, e.g. "This constructor invokes the selected stream handler's parseURL method to parse the URL."
There was a problem hiding this comment.
Well some of the parsing is done in URL itself: like finding the fragment, if any, setting up start and limit etc... And I didn't want to get into the rabbit hole of trying to specify what does what exactly. I can still take your suggested text if you believe it doesn't matter?
There was a problem hiding this comment.
Okay, maybe your wording would be be okay if you changed "involves" to "includes" as the former hints that there is more going on that is not specified.
| * of the associated protocol. In particular, if the | ||
| * underlying stream handler's {@linkplain | ||
| * URLStreamHandler#parseURL parseURL method} throws | ||
| * {@code IllegalArgumentException} |
There was a problem hiding this comment.
This looks okay but it might be simpler to drop "In particular" and just say "or the stream handler's parseURL throws ...".
There was a problem hiding this comment.
Thanks @AlanBateman I have pushed all the requested changes and updated the CSR. If that looks good to you I will finalize the CSR.
|
@dfuch 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: 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 9 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
|
/integrate |
|
Going to push as commit 9d0cfd1.
Your commit was automatically rebased without conflicts. |
During the review of JDK-8293590, it was noted that some methods in
URLStreamHandlerwere missing an@throws IllegalArgumentExceptionclause in their API documentation.This change adds the requested information, and also clarifies throwing
MalformedURLExceptionfrom URL constructors.The CSR can be reviewed here: https://bugs.openjdk.org/browse/JDK-8294984
Progress
Issues
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/10609/head:pull/10609$ git checkout pull/10609Update a local copy of the PR:
$ git checkout pull/10609$ git pull https://git.openjdk.org/jdk pull/10609/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 10609View PR using the GUI difftool:
$ git pr show -t 10609Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/10609.diff