On Tue, 6 Feb 2024 18:40:20 GMT, Chen Liang <li...@openjdk.org> wrote:

>> Adding a fast-path for ASCII-only modified UTF-8 strings deserialied via 
>> Data- and ObjectInputStream
>> 
>> Testing: tier1-3
>
> src/java.base/share/classes/java/io/ObjectInputStream.java line 3688:
> 
>> 3686:                         // avoid a redundant scan
>> 3687:                         String utf = new String(buf, pos, (int)utflen, 
>> StandardCharsets.ISO_8859_1);
>> 3688:                         pos += (int)utflen;
> 
> Suggestion:
> 
>                         String utf = new String(buf, pos, ascii, 
> StandardCharsets.ISO_8859_1);
>                         pos += ascii;
> 
> Redundant casts

I get warnings and build failures if I leave out those casts (`utflen` is a 
`long`)

> src/java.base/share/classes/java/nio/charset/Charset.java line 682:
> 
>> 680:                 else
>> 681:                     defaultCharset = sun.nio.cs.UTF_8.INSTANCE;
>> 682:                 Charset.forName("UTF-8");
> 
> Redundant debug code?

Yes, accidentally included here.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17734#discussion_r1480406485
PR Review Comment: https://git.openjdk.org/jdk/pull/17734#discussion_r1480404260

Reply via email to