mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8251989: Hex formatting and parsing utility
Reviewed-by: tvaleev, chegar, naoto, darcy
This commit is contained in:
parent
efd61c6f53
commit
aa9c136d67
14 changed files with 1921 additions and 167 deletions
|
@ -35,6 +35,7 @@ import java.util.Collection;
|
|||
import java.util.Deque;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.HexFormat;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -475,9 +476,10 @@ final class Resolver {
|
|||
if (actualHash == null)
|
||||
findFail("Unable to compute the hash of module %s", dn);
|
||||
if (!Arrays.equals(recordedHash, actualHash)) {
|
||||
HexFormat hex = HexFormat.of();
|
||||
findFail("Hash of %s (%s) differs to expected hash (%s)" +
|
||||
" recorded in %s", dn, toHexString(actualHash),
|
||||
toHexString(recordedHash), descriptor.name());
|
||||
" recorded in %s", dn, hex.formatHex(actualHash),
|
||||
hex.formatHex(recordedHash), descriptor.name());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -485,15 +487,6 @@ final class Resolver {
|
|||
}
|
||||
}
|
||||
|
||||
private static String toHexString(byte[] ba) {
|
||||
StringBuilder sb = new StringBuilder(ba.length * 2);
|
||||
for (byte b: ba) {
|
||||
sb.append(String.format("%02x", b & 0xff));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Computes the readability graph for the modules in the given Configuration.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue