RFR: JDK-8077371: Binary files in JAXP test should be removed [v9]

Roger Riggs rriggs at openjdk.org
Fri Oct 13 15:48:44 UTC 2023


On Fri, 13 Oct 2023 12:21:28 GMT, Mahendra Chhipa <mchhipa at openjdk.org> wrote:

>> Test is updated to create the binary files during test execution.
>
> Mahendra Chhipa has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Tests with base64 input are removed.

test/jdk/javax/xml/jaxp/datatype/8033980/GregorianCalAndDurSerDataUtil.java line 118:

> 116:             fmt.format(" (byte) 0x%x,", bytes[i] & 0xff);
> 117:         }
> 118:         fmt.format("%n    };%n");

You might find that java.util.HexFormat would be useful here.

import java.util.HexFormat;

HexFormat hex = HexFormat.ofDelimiter(", ").withPrefix("(byte)%x");
for (int i = 0; i < bytes.length; i += linelen) {
    System.out.print(" ".repeat(linelen));
    System.out.println(hex.formatHex(bytes, i, Math.min(i + linelen, bytes.length)));
}

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13537#discussion_r1358435078


More information about the core-libs-dev mailing list