RFR: 8306461: ObjectInputStream::readObject() should handle negative array sizes without throwing NegativeArraySizeExceptions [v2]
Volker Simonis
simonis at openjdk.org
Wed Apr 26 11:56:55 UTC 2023
On Mon, 24 Apr 2023 15:58:49 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
>> Volker Simonis has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Addresed review comments of @turbanoff, @shipilev and @RogerRiggs
>
> test/jdk/java/io/ObjectInputStream/NegativeArraySizeTest.java line 104:
>
>> 102: }
>> 103: // OK, because a NegativeArraySizeException should be converted into a ObjectStreamException *before* filtering
>> 104: if ("Array length is negative".equals(ose.getMessage())) {
>
> Same as above.
Obviously!
Good catch. The problem was that the exception message also contained the name of the array class that's why *it worked*. I've now simplified to only contain the message "Array length is negative" which I think is in line with Roger'S previous comment to "*keep the exception logic simple/minimal*".
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13540#discussion_r1177749681
More information about the core-libs-dev
mailing list