RFR: 8306461: ObjectInputStream::readObject() should handle negative array sizes without throwing NegativeArraySizeExceptions [v2]
Roger Riggs
rriggs at openjdk.org
Tue Apr 25 21:04:08 UTC 2023
On Mon, 24 Apr 2023 15:58:41 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 88:
>
>> 86: } catch (ObjectStreamException ose) {
>> 87: // OK, because a NegativeArraySizeException should be converted into a ObjectStreamException
>> 88: if ("Array length is negative".equals(ose.getMessage())) {
>
> This feels like `!equals`, i.e. throw exception when the message is *not* "Array length is negative"?
The complete `getMessage()` is `[Ljava.lang.String;; Array length is negative`.
Perhaps:
ose.getMessage().contains("Array length is negative") ...
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13540#discussion_r1177050269
More information about the core-libs-dev
mailing list