mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8267397: AlgorithmId's OID cache is never refreshed
Reviewed-by: xuelei
This commit is contained in:
parent
ee3015968d
commit
f69e2d5651
3 changed files with 85 additions and 29 deletions
|
@ -26,6 +26,7 @@
|
|||
package sun.security.jca;
|
||||
|
||||
import java.security.Provider;
|
||||
import sun.security.x509.AlgorithmId;
|
||||
|
||||
/**
|
||||
* Collection of methods to get and set provider list. Also includes
|
||||
|
@ -150,7 +151,17 @@ public class Providers {
|
|||
} else {
|
||||
changeThreadProviderList(newList);
|
||||
}
|
||||
clearCachedValues();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the cached provider-list-specific values. These values need to
|
||||
* be re-generated whenever provider list is changed. The logic for
|
||||
* generating them is in the respective classes.
|
||||
*/
|
||||
private static void clearCachedValues() {
|
||||
JCAUtil.clearDefSecureRandom();
|
||||
AlgorithmId.clearAliasOidsTable();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -536,6 +536,11 @@ public class AlgorithmId implements Serializable, DerEncoder {
|
|||
// oid string cache index'ed by algorithm name and oid strings
|
||||
private static volatile Map<String,String> aliasOidsTable;
|
||||
|
||||
// called by sun.security.jca.Providers whenever provider list is changed
|
||||
public static void clearAliasOidsTable() {
|
||||
aliasOidsTable = null;
|
||||
}
|
||||
|
||||
// returns the aliasOidsTable, lazily initializing it on first access.
|
||||
private static Map<String,String> aliasOidsTable() {
|
||||
// Double checked locking; safe because aliasOidsTable is volatile
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue