[jdk17u-dev] RFR: 8302111: Serialization considerations [v2]

Goetz Lindenmaier goetz at openjdk.org
Thu Feb 20 16:03:08 UTC 2025


On Thu, 20 Feb 2025 08:03:22 GMT, Richard Reingruber <rrich at openjdk.org> wrote:

>> Goetz Lindenmaier has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Remove mentioning of ProviderException
>
> src/java.base/share/classes/com/sun/crypto/provider/DHPrivateKey.java line 379:
> 
>> 377:         } catch (IOException e) {
>> 378:             InvalidObjectException ioe = new InvalidObjectException("Invalid encoding");
>> 379:             if (ioe != null) {
> 
> Isn't this condition always true?
> Note also that the throw below will throw a NPE if it `ioe` was null.
> I think you can actually remove the condition.

My inital desing was 
throw new InvalidObjectException("Invalid encoding").initCause(e);
But the compiler does not like this:
error: unreported exception Throwable; must be caught or declared to be thrown
So I decided to add the try/catch with the null check.

-------------

PR Review Comment: https://git.openjdk.org/jdk17u-dev/pull/3278#discussion_r1963863612


More information about the jdk-updates-dev mailing list