RFR: JDK-8282696: Add constructors take a cause to InvalidObjectException and InvalidClassException [v2]
Roger Riggs
rriggs at openjdk.java.net
Sat Mar 5 03:24:07 UTC 2022
On Sat, 5 Mar 2022 03:14:36 GMT, Joe Darcy <darcy at openjdk.org> wrote:
>> 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
>
> Joe Darcy has updated the pull request incrementally with one additional commit since the last revision:
>
> Retrofit another location.
Changes requested by rriggs (Reviewer).
src/java.base/share/classes/java/io/InvalidObjectException.java line 63:
> 61: */
> 62: public InvalidObjectException(String reason, Throwable cause) {
> 63: super(reason);
Should this be: `super(reason, cause)`?
src/java.base/share/classes/java/io/ObjectInputStream.java line 2218:
> 2216: throw new InvalidObjectException("enum constant " +
> 2217: name + " does not exist in " +
> 2218: cl, ex);
Can this be reflowed to be on two lines instead of 3? Your call.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7711
More information about the core-libs-dev
mailing list