RFR: 8289797: tools/launcher/I18NArgTest.java fails on Japanese Windows environment [v3]

Roger Riggs rriggs at openjdk.org
Fri Sep 16 14:01:44 UTC 2022


On Fri, 16 Sep 2022 08:31:19 GMT, KIRIYAMA Takuya <duke at openjdk.org> wrote:

>> test/jdk/tools/launcher/I18NArgTest.java line 147:
>> 
>>> 145:             for (int i = 0; i < sysPropVal.length(); i++) {
>>> 146:                 sysPropHexVal = sysPropHexVal.concat(Integer.toHexString(sysPropVal.charAt(i)));
>>> 147:             }
>> 
>> It's OK as it stands, but this loop could be replaced with a `HexFormat` one-liner.
>
> I'm sorry, I can't replace this code with a HexFormat one-line. Do you have an example code?

Extract to a byte array with the appropriate charset and then HexFormat the bytearray.


    var SysPropHexVal = HexFormat.of().formatHex(sysPropVal.getBytes(StandardCharsets.UTF_16));

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

PR: https://git.openjdk.org/jdk/pull/9389


More information about the core-libs-dev mailing list