8263754: HexFormat 'fromHex' methods should be static

Reviewed-by: redestad, naoto, chegar
This commit is contained in:
Roger Riggs 2021-03-29 20:38:10 +00:00
parent a5d7de2351
commit 8cf1c62c34
5 changed files with 39 additions and 54 deletions

View file

@ -40,7 +40,6 @@ import java.security.cert.URICertStoreParameters;
import java.security.interfaces.ECKey;
import java.security.interfaces.EdECKey;
import java.security.spec.AlgorithmParameterSpec;
import java.security.spec.ECParameterSpec;
import java.text.Collator;
import java.text.MessageFormat;
@ -4574,16 +4573,15 @@ public final class Main {
break;
case -1:
ObjectIdentifier oid = ObjectIdentifier.of(name);
HexFormat hexFmt = HexFormat.of();
byte[] data = null;
if (value != null) {
data = new byte[value.length() / 2 + 1];
int pos = 0;
for (char c: value.toCharArray()) {
if (!hexFmt.isHexDigit(c)) {
if (!HexFormat.isHexDigit(c)) {
continue;
}
int hex = hexFmt.fromHexDigit(c);
int hex = HexFormat.fromHexDigit(c);
if (pos % 2 == 0) {
data[pos/2] = (byte)(hex << 4);
} else {