New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JDK-8282696: Add constructors taking a cause to InvalidObjectException and InvalidClassException #7711
Conversation
…and InvalidClassException
/csr |
|
@jddarcy this pull request will not be integrated until the CSR request JDK-8282697 for issue JDK-8282696 has been approved. |
Webrevs
|
* @since 19 | ||
*/ | ||
public InvalidObjectException(String reason, Throwable cause) { | ||
super(reason); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be: super(reason, cause)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes; good catch -- will fix in the next push. Thanks.
cl).initCause(ex); | ||
throw new InvalidObjectException("enum constant " + | ||
name + " does not exist in " + | ||
cl, ex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be reflowed to be on two lines instead of 3? Your call.
@jddarcy This change now passes all automated pre-integration checks. 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 3 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
|
src/java.base/share/classes/java/io/InvalidObjectException.java
Outdated
Show resolved
Hide resolved
@@ -48,4 +48,18 @@ | |||
public InvalidObjectException(String reason) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public InvalidObjectException(String reason) { | |
public InvalidObjectException(String reason) { |
/integrate |
Going to push as commit 104e3cb.
Your commit was automatically rebased without conflicts. |
Occasionally in core-libs we've discussed whether or not to do a pass over the exception classes and proactively add any of four missing convention constructors per java.lang.Throwable (no-arg, string, cause, cause and string). Last time this came up, we decided a wide-scale effort wasn't worthwhile.
Prompted by some other recent work, I decided to take a quick look at the dual-approach: grep for calls to initCause in java.base and seeing which exception classes repeated were initCaused. Those exception classes are good candidates for cause-taking constructors.
Two such exception classes area InvalidObjectException and InvalidClassException, along with their superclass ObjectStreamException.
Please also review the CSR: https://bugs.openjdk.java.net/browse/JDK-8282697
Progress
Issues
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/7711/head:pull/7711
$ git checkout pull/7711
Update a local copy of the PR:
$ git checkout pull/7711
$ git pull https://git.openjdk.java.net/jdk pull/7711/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 7711
View PR using the GUI difftool:
$ git pr show -t 7711
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/7711.diff