mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8312443: sun.security should use toLowerCase(Locale.ROOT)
Reviewed-by: xuelei
This commit is contained in:
parent
d7b9416406
commit
4e8f331a80
3 changed files with 8 additions and 7 deletions
|
@ -27,6 +27,7 @@ package sun.security.action;
|
|||
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.Locale;
|
||||
import java.util.Properties;
|
||||
import sun.security.util.Debug;
|
||||
|
||||
|
@ -194,10 +195,10 @@ public class GetPropertyAction implements PrivilegedAction<String> {
|
|||
// the original value in rawPropVal for debug messages.
|
||||
boolean isMillis = false;
|
||||
String propVal = rawPropVal;
|
||||
if (rawPropVal.toLowerCase().endsWith("ms")) {
|
||||
if (rawPropVal.toLowerCase(Locale.ROOT).endsWith("ms")) {
|
||||
propVal = rawPropVal.substring(0, rawPropVal.length() - 2);
|
||||
isMillis = true;
|
||||
} else if (rawPropVal.toLowerCase().endsWith("s")) {
|
||||
} else if (rawPropVal.toLowerCase(Locale.ROOT).endsWith("s")) {
|
||||
propVal = rawPropVal.substring(0, rawPropVal.length() - 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -31,6 +31,7 @@ import sun.security.x509.AlgorithmId;
|
|||
import java.security.spec.AlgorithmParameterSpec;
|
||||
import java.security.spec.NamedParameterSpec;
|
||||
import java.util.Collections;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.Optional;
|
||||
|
@ -53,7 +54,7 @@ public class ParametersMap<T> {
|
|||
}
|
||||
|
||||
public void put(String name, ObjectIdentifier oid, int size, T params) {
|
||||
nameMap.put(name.toLowerCase(), params);
|
||||
nameMap.put(name.toLowerCase(Locale.ROOT), params);
|
||||
oidMap.put(oid, params);
|
||||
sizeMap.put(size, params);
|
||||
}
|
||||
|
@ -65,7 +66,7 @@ public class ParametersMap<T> {
|
|||
return Optional.ofNullable(sizeMap.get(size));
|
||||
}
|
||||
public Optional<T> getByName(String name) {
|
||||
return Optional.ofNullable(nameMap.get(name.toLowerCase()));
|
||||
return Optional.ofNullable(nameMap.get(name.toLowerCase(Locale.ROOT)));
|
||||
}
|
||||
|
||||
// Utility method that is used by the methods below to handle exception
|
||||
|
|
|
@ -137,7 +137,7 @@ public class XECParameters {
|
|||
ObjectIdentifier oid = ObjectIdentifier.of(koid);
|
||||
XECParameters params =
|
||||
new XECParameters(bits, p, a24, basePoint, logCofactor, oid, name);
|
||||
namedParams.put(name.toLowerCase(), oid, bits, params);
|
||||
namedParams.put(name, oid, bits, params);
|
||||
return params;
|
||||
}
|
||||
|
||||
|
@ -170,4 +170,3 @@ public class XECParameters {
|
|||
return namedParams.get(exception, params);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue