RFR: 8264485: build.tools.depend.Depend.toString(byte[]) creates malformed hex strings

Adam Sotona asotona at openjdk.java.net
Tue Nov 30 11:03:25 UTC 2021


make/jdk/src/classes/build/tools/depend/Depend.java method toString(byte[]) constructs hex string out of the given byte array.
Actual implementation is using custom conversion code, which does not pad byte values <16 with leading zero.
Resulting hex string is invalid and for example sequence of bytes 1 and 0 generates the same hex string as a single byte 16.

Proposed patch is delegating hex conversion to java.util.HexFormat instead.

Thanks,
Adam

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

Commit messages:
 - 8264485: build.tools.depend.Depend.toString(byte[]) creates malformed hex strings

Changes: https://git.openjdk.java.net/jdk/pull/6610/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=6610&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8264485
  Stats: 8 lines in 1 file changed: 1 ins; 6 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/6610.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/6610/head:pull/6610

PR: https://git.openjdk.java.net/jdk/pull/6610


More information about the compiler-dev mailing list