RFR: 8339699: Optimize DataOutputStream writeUTF [v5]
Shaojin Wen
swen at openjdk.org
Fri Sep 20 05:12:37 UTC 2024
On Thu, 19 Sep 2024 19:00:45 GMT, Chen Liang <liach at openjdk.org> wrote:
>> Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision:
>>
>> suggestion from @liach
>
> src/java.base/share/classes/java/io/ObjectOutputStream.java line 2047:
>
>> 2045: writeByte(TC_LONGSTRING);
>> 2046: }
>> 2047: writeLong(utflen);
>
> The old plain `writeUTF` does not write a long utf if the length is too long, but rather throws an `UTFDataFormatException`. There should be code paths that no longer throw this exception, because a few tests, including:
> - `java/io/Serializable/longString/LongString.java`
> - `java/io/Serializable/sanityCheck/SanityCheck.java`
> - `java/text/Format/DateFormat/DateFormatRegression.java`
> are failing. I think this might be the root cause.
The reason for the error is that when the `drain` method is called, the local variable pos is not updated to the field `pos`
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20886#discussion_r1767990262
More information about the core-libs-dev
mailing list