Warnings Cleanup in java.util.<various> (more from hack day)

Xueming Shen xueming.shen at oracle.com
Fri Dec 2 12:22:32 PST 2011


Mike,

I would prefer to leave the "utf8" usage here un-changed.

 From performance point of view, String.getBytes("UTF8") is faster
than String.getBytes(StandardCharsets.UTF_8).

I have some measurement when I did the related performance work at

http://cr.openjdk.java.net/~sherman/7040220/client
http://cr.openjdk.java.net/~sherman/7040220/server

#String.getBytes() is the "encoding".


-Sherman

On 12/02/2011 12:02 PM, Michael Barker wrote:
>> one change to Manifest.java introduces a bug !
>>
>> -                byte[] vb = value.getBytes("UTF8");
>> -                value = new String(vb, 0, 0, vb.length);
>> +                byte[] vb = value.getBytes(StandardCharsets.UTF_8);
>> +                value = new String(vb, 0, 0, StandardCharsets.UTF_8);
>>
>>
>> the last line should be:
>> value = new String(vb, 0, 0, vb.length);
> Cheers, good spot.  I've attached an updated patch.
>
> Mike.



More information about the jdk8-dev mailing list