mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-02 20:20:14 +00:00
8078468: Update security libraries to use diamond with anonymous classes
Reviewed-by: weijun
This commit is contained in:
parent
18bafb792c
commit
dd2c3d1c22
@ -711,7 +711,7 @@ public final class JceKeyStore extends KeyStoreSpi {
|
||||
cf = CertificateFactory.getInstance("X509");
|
||||
} else {
|
||||
// version 2
|
||||
cfs = new Hashtable<String, CertificateFactory>(3);
|
||||
cfs = new Hashtable<>(3);
|
||||
}
|
||||
|
||||
entries.clear();
|
||||
|
||||
@ -56,7 +56,7 @@ abstract class PBEKeyFactory extends SecretKeyFactorySpi {
|
||||
}
|
||||
|
||||
static {
|
||||
validTypes = new HashSet<String>(17);
|
||||
validTypes = new HashSet<>(17);
|
||||
validTypes.add("PBEWithMD5AndDES".toUpperCase(Locale.ENGLISH));
|
||||
validTypes.add("PBEWithSHA1AndDESede".toUpperCase(Locale.ENGLISH));
|
||||
validTypes.add("PBEWithSHA1AndRC2_40".toUpperCase(Locale.ENGLISH));
|
||||
|
||||
@ -115,7 +115,7 @@ public final class SunJCE extends Provider {
|
||||
final String BLOCK_PADS = "NOPADDING|PKCS5PADDING|ISO10126PADDING";
|
||||
|
||||
AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Object>() {
|
||||
new java.security.PrivilegedAction<>() {
|
||||
public Object run() {
|
||||
|
||||
/*
|
||||
|
||||
@ -63,7 +63,7 @@ public class KeyManagerFactory {
|
||||
*/
|
||||
public final static String getDefaultAlgorithm() {
|
||||
String type;
|
||||
type = AccessController.doPrivileged(new PrivilegedAction<String>() {
|
||||
type = AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
public String run() {
|
||||
return Security.getProperty("sun.ssl.keymanager.type");
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ public class TrustManagerFactory {
|
||||
*/
|
||||
public final static String getDefaultAlgorithm() {
|
||||
String type;
|
||||
type = AccessController.doPrivileged(new PrivilegedAction<String>() {
|
||||
type = AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
public String run() {
|
||||
return Security.getProperty("sun.ssl.trustmanager.type");
|
||||
}
|
||||
|
||||
@ -458,7 +458,7 @@ public final class AccessControlContext {
|
||||
Thread.dumpStack();
|
||||
final ProtectionDomain pd = context[i];
|
||||
final Debug db = debug;
|
||||
AccessController.doPrivileged (new PrivilegedAction<Void>() {
|
||||
AccessController.doPrivileged (new PrivilegedAction<>() {
|
||||
public Void run() {
|
||||
db.println("domain that failed "+pd);
|
||||
return null;
|
||||
|
||||
@ -612,7 +612,7 @@ public final class AccessController {
|
||||
|
||||
private static ProtectionDomain getCallerPD(final Class <?> caller) {
|
||||
ProtectionDomain callerPd = doPrivileged
|
||||
(new PrivilegedAction<ProtectionDomain>() {
|
||||
(new PrivilegedAction<>() {
|
||||
public ProtectionDomain run() {
|
||||
return caller.getProtectionDomain();
|
||||
}
|
||||
|
||||
@ -212,7 +212,7 @@ final class AllPermissionCollection
|
||||
* @return an enumeration of all the AllPermission objects.
|
||||
*/
|
||||
public Enumeration<Permission> elements() {
|
||||
return new Enumeration<Permission>() {
|
||||
return new Enumeration<>() {
|
||||
private boolean hasMore = all_allowed;
|
||||
|
||||
public boolean hasMoreElements() {
|
||||
|
||||
@ -332,7 +332,7 @@ final class BasicPermissionCollection
|
||||
*/
|
||||
|
||||
public BasicPermissionCollection(Class<?> clazz) {
|
||||
perms = new HashMap<String, Permission>(11);
|
||||
perms = new HashMap<>(11);
|
||||
all_allowed = false;
|
||||
permClass = clazz;
|
||||
}
|
||||
@ -533,7 +533,7 @@ final class BasicPermissionCollection
|
||||
@SuppressWarnings("unchecked")
|
||||
Hashtable<String, Permission> permissions =
|
||||
(Hashtable<String, Permission>)gfields.get("permissions", null);
|
||||
perms = new HashMap<String, Permission>(permissions.size()*2);
|
||||
perms = new HashMap<>(permissions.size()*2);
|
||||
perms.putAll(permissions);
|
||||
|
||||
// Get all_allowed
|
||||
|
||||
@ -543,7 +543,7 @@ public class CodeSource implements java.io.Serializable {
|
||||
if (size > 0) {
|
||||
// we know of 3 different cert types: X.509, PGP, SDSI, which
|
||||
// could all be present in the stream at the same time
|
||||
cfs = new Hashtable<String, CertificateFactory>(3);
|
||||
cfs = new Hashtable<>(3);
|
||||
this.certs = new java.security.cert.Certificate[size];
|
||||
}
|
||||
|
||||
|
||||
@ -185,7 +185,7 @@ public abstract class Identity implements Principal, Serializable {
|
||||
|
||||
check("setIdentityPublicKey");
|
||||
this.publicKey = key;
|
||||
certificates = new Vector<Certificate>();
|
||||
certificates = new Vector<>();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -248,7 +248,7 @@ public abstract class Identity implements Principal, Serializable {
|
||||
check("addIdentityCertificate");
|
||||
|
||||
if (certificates == null) {
|
||||
certificates = new Vector<Certificate>();
|
||||
certificates = new Vector<>();
|
||||
}
|
||||
if (publicKey != null) {
|
||||
if (!keyEquals(publicKey, certificate.getPublicKey())) {
|
||||
|
||||
@ -74,7 +74,7 @@ class IdentityScope extends Identity {
|
||||
private static void initializeSystemScope() {
|
||||
|
||||
String classname = AccessController.doPrivileged(
|
||||
new PrivilegedAction<String>() {
|
||||
new PrivilegedAction<>() {
|
||||
public String run() {
|
||||
return Security.getProperty("system.scope");
|
||||
}
|
||||
|
||||
@ -976,7 +976,7 @@ public class KeyStore {
|
||||
*/
|
||||
public final static String getDefaultType() {
|
||||
String kstype;
|
||||
kstype = AccessController.doPrivileged(new PrivilegedAction<String>() {
|
||||
kstype = AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
public String run() {
|
||||
return Security.getProperty(KEYSTORE_TYPE);
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ implements Serializable
|
||||
* Creates a new Permissions object containing no PermissionCollections.
|
||||
*/
|
||||
public Permissions() {
|
||||
permsMap = new HashMap<Class<?>, PermissionCollection>(11);
|
||||
permsMap = new HashMap<>(11);
|
||||
allPermission = null;
|
||||
}
|
||||
|
||||
@ -394,7 +394,7 @@ implements Serializable
|
||||
@SuppressWarnings("unchecked")
|
||||
Hashtable<Class<?>, PermissionCollection> perms =
|
||||
(Hashtable<Class<?>, PermissionCollection>)gfields.get("perms", null);
|
||||
permsMap = new HashMap<Class<?>, PermissionCollection>(perms.size()*2);
|
||||
permsMap = new HashMap<>(perms.size()*2);
|
||||
permsMap.putAll(perms);
|
||||
|
||||
// Set hasUnresolved
|
||||
@ -488,7 +488,7 @@ implements Serializable
|
||||
*/
|
||||
|
||||
PermissionsHash() {
|
||||
permsMap = new HashMap<Permission, Permission>(11);
|
||||
permsMap = new HashMap<>(11);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -597,7 +597,7 @@ implements Serializable
|
||||
@SuppressWarnings("unchecked")
|
||||
Hashtable<Permission, Permission> perms =
|
||||
(Hashtable<Permission, Permission>)gfields.get("perms", null);
|
||||
permsMap = new HashMap<Permission, Permission>(perms.size()*2);
|
||||
permsMap = new HashMap<>(perms.size()*2);
|
||||
permsMap.putAll(perms);
|
||||
}
|
||||
}
|
||||
|
||||
@ -170,7 +170,7 @@ public abstract class Policy {
|
||||
PolicyInfo pinfo = policy.get();
|
||||
if (pinfo.policy == null) {
|
||||
String policy_class = AccessController.doPrivileged(
|
||||
new PrivilegedAction<String>() {
|
||||
new PrivilegedAction<>() {
|
||||
public String run() {
|
||||
return Security.getProperty("policy.provider");
|
||||
}
|
||||
@ -199,7 +199,7 @@ public abstract class Policy {
|
||||
|
||||
final String pc = policy_class;
|
||||
Policy pol = AccessController.doPrivileged(
|
||||
new PrivilegedAction<Policy>() {
|
||||
new PrivilegedAction<>() {
|
||||
public Policy run() {
|
||||
try {
|
||||
ClassLoader cl =
|
||||
@ -303,7 +303,7 @@ public abstract class Policy {
|
||||
*/
|
||||
|
||||
ProtectionDomain policyDomain =
|
||||
AccessController.doPrivileged(new PrivilegedAction<ProtectionDomain>() {
|
||||
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
public ProtectionDomain run() {
|
||||
return p.getClass().getProtectionDomain();
|
||||
}
|
||||
|
||||
@ -367,7 +367,7 @@ public class ProtectionDomain {
|
||||
|
||||
PermissionCollection perms =
|
||||
java.security.AccessController.doPrivileged
|
||||
(new java.security.PrivilegedAction<PermissionCollection>() {
|
||||
(new java.security.PrivilegedAction<>() {
|
||||
public PermissionCollection run() {
|
||||
Policy p = Policy.getPolicyNoCheck();
|
||||
return p.getPermissions(ProtectionDomain.this);
|
||||
|
||||
@ -711,7 +711,7 @@ public abstract class Provider extends Properties {
|
||||
|
||||
legacyChanged = true;
|
||||
if (legacyStrings == null) {
|
||||
legacyStrings = new LinkedHashMap<String,String>();
|
||||
legacyStrings = new LinkedHashMap<>();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -773,7 +773,7 @@ public abstract class Provider extends Properties {
|
||||
private void implReplaceAll(BiFunction<? super Object, ? super Object, ? extends Object> function) {
|
||||
legacyChanged = true;
|
||||
if (legacyStrings == null) {
|
||||
legacyStrings = new LinkedHashMap<String,String>();
|
||||
legacyStrings = new LinkedHashMap<>();
|
||||
} else {
|
||||
legacyStrings.replaceAll((BiFunction<? super String, ? super String, ? extends String>) function);
|
||||
}
|
||||
@ -905,7 +905,7 @@ public abstract class Provider extends Properties {
|
||||
}
|
||||
serviceSet = null;
|
||||
if (legacyMap == null) {
|
||||
legacyMap = new LinkedHashMap<ServiceKey,Service>();
|
||||
legacyMap = new LinkedHashMap<>();
|
||||
} else {
|
||||
legacyMap.clear();
|
||||
}
|
||||
@ -1133,7 +1133,7 @@ public abstract class Provider extends Properties {
|
||||
("service.getProvider() must match this Provider object");
|
||||
}
|
||||
if (serviceMap == null) {
|
||||
serviceMap = new LinkedHashMap<ServiceKey,Service>();
|
||||
serviceMap = new LinkedHashMap<>();
|
||||
}
|
||||
servicesChanged = true;
|
||||
String type = s.getType();
|
||||
@ -1305,7 +1305,7 @@ public abstract class Provider extends Properties {
|
||||
}
|
||||
|
||||
static {
|
||||
knownEngines = new HashMap<String,EngineDescription>();
|
||||
knownEngines = new HashMap<>();
|
||||
// JCA
|
||||
addEngine("AlgorithmParameterGenerator", false, null);
|
||||
addEngine("AlgorithmParameters", false, null);
|
||||
@ -1431,14 +1431,14 @@ public abstract class Provider extends Properties {
|
||||
|
||||
private void addAlias(String alias) {
|
||||
if (aliases.isEmpty()) {
|
||||
aliases = new ArrayList<String>(2);
|
||||
aliases = new ArrayList<>(2);
|
||||
}
|
||||
aliases.add(alias);
|
||||
}
|
||||
|
||||
void addAttribute(String type, String value) {
|
||||
if (attributes.isEmpty()) {
|
||||
attributes = new HashMap<UString,String>(8);
|
||||
attributes = new HashMap<>(8);
|
||||
}
|
||||
attributes.put(new UString(type), value);
|
||||
}
|
||||
@ -1471,12 +1471,12 @@ public abstract class Provider extends Properties {
|
||||
if (aliases == null) {
|
||||
this.aliases = Collections.<String>emptyList();
|
||||
} else {
|
||||
this.aliases = new ArrayList<String>(aliases);
|
||||
this.aliases = new ArrayList<>(aliases);
|
||||
}
|
||||
if (attributes == null) {
|
||||
this.attributes = Collections.<UString,String>emptyMap();
|
||||
} else {
|
||||
this.attributes = new HashMap<UString,String>();
|
||||
this.attributes = new HashMap<>();
|
||||
for (Map.Entry<String,String> entry : attributes.entrySet()) {
|
||||
this.attributes.put(new UString(entry.getKey()), entry.getValue());
|
||||
}
|
||||
@ -1644,7 +1644,7 @@ public abstract class Provider extends Properties {
|
||||
("class configured for " + type + " (provider: " +
|
||||
provider.getName() + ") is not public.");
|
||||
}
|
||||
classRef = new WeakReference<Class<?>>(clazz);
|
||||
classRef = new WeakReference<>(clazz);
|
||||
}
|
||||
return clazz;
|
||||
} catch (ClassNotFoundException e) {
|
||||
|
||||
@ -616,7 +616,7 @@ public class SecureRandom extends java.util.Random {
|
||||
throws NoSuchAlgorithmException {
|
||||
|
||||
String property = AccessController.doPrivileged(
|
||||
new PrivilegedAction<String>() {
|
||||
new PrivilegedAction<>() {
|
||||
@Override
|
||||
public String run() {
|
||||
return Security.getProperty(
|
||||
|
||||
@ -66,7 +66,7 @@ public final class Security {
|
||||
// things in initialize that might require privs.
|
||||
// (the FileInputStream call and the File.exists call,
|
||||
// the securityPropFile call, etc)
|
||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
||||
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
public Void run() {
|
||||
initialize();
|
||||
return null;
|
||||
@ -810,7 +810,7 @@ public final class Security {
|
||||
final boolean pd = key.equals("package.definition");
|
||||
|
||||
if (pa || pd) {
|
||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
||||
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
public Void run() {
|
||||
try {
|
||||
/* Get the class via the bootstrap class loader. */
|
||||
|
||||
@ -265,7 +265,7 @@ public abstract class Signature extends SignatureSpi {
|
||||
private final static Map<String,Boolean> signatureInfo;
|
||||
|
||||
static {
|
||||
signatureInfo = new ConcurrentHashMap<String,Boolean>();
|
||||
signatureInfo = new ConcurrentHashMap<>();
|
||||
Boolean TRUE = Boolean.TRUE;
|
||||
// pre-initialize with values for our SignatureSpi implementations
|
||||
signatureInfo.put("sun.security.provider.DSA$RawDSA", TRUE);
|
||||
|
||||
@ -140,7 +140,7 @@ public abstract class Signer extends Identity {
|
||||
}
|
||||
try {
|
||||
AccessController.doPrivileged(
|
||||
new PrivilegedExceptionAction<Void>() {
|
||||
new PrivilegedExceptionAction<>() {
|
||||
public Void run() throws KeyManagementException {
|
||||
setPublicKey(pub);
|
||||
return null;
|
||||
|
||||
@ -560,7 +560,7 @@ implements java.io.Serializable
|
||||
if (size > 0) {
|
||||
// we know of 3 different cert types: X.509, PGP, SDSI, which
|
||||
// could all be present in the stream at the same time
|
||||
cfs = new Hashtable<String, CertificateFactory>(3);
|
||||
cfs = new Hashtable<>(3);
|
||||
this.certs = new java.security.cert.Certificate[size];
|
||||
}
|
||||
|
||||
|
||||
@ -61,7 +61,7 @@ implements java.io.Serializable
|
||||
*
|
||||
*/
|
||||
public UnresolvedPermissionCollection() {
|
||||
perms = new HashMap<String, List<UnresolvedPermission>>(11);
|
||||
perms = new HashMap<>(11);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -82,7 +82,7 @@ implements java.io.Serializable
|
||||
synchronized (this) {
|
||||
v = perms.get(up.getName());
|
||||
if (v == null) {
|
||||
v = new ArrayList<UnresolvedPermission>();
|
||||
v = new ArrayList<>();
|
||||
perms.put(up.getName(), v);
|
||||
}
|
||||
}
|
||||
@ -203,7 +203,7 @@ implements java.io.Serializable
|
||||
Hashtable<String, Vector<UnresolvedPermission>> permissions =
|
||||
(Hashtable<String, Vector<UnresolvedPermission>>)
|
||||
gfields.get("permissions", null);
|
||||
perms = new HashMap<String, List<UnresolvedPermission>>(permissions.size()*2);
|
||||
perms = new HashMap<>(permissions.size()*2);
|
||||
|
||||
// Convert each entry (Vector) into a List
|
||||
Set<Map.Entry<String, Vector<UnresolvedPermission>>> set = permissions.entrySet();
|
||||
|
||||
@ -301,7 +301,7 @@ public class CertPathBuilder {
|
||||
*/
|
||||
public final static String getDefaultType() {
|
||||
String cpbtype =
|
||||
AccessController.doPrivileged(new PrivilegedAction<String>() {
|
||||
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
public String run() {
|
||||
return Security.getProperty(CPB_TYPE);
|
||||
}
|
||||
|
||||
@ -313,7 +313,7 @@ public class CertPathValidator {
|
||||
*/
|
||||
public final static String getDefaultType() {
|
||||
String cpvtype =
|
||||
AccessController.doPrivileged(new PrivilegedAction<String>() {
|
||||
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
public String run() {
|
||||
return Security.getProperty(CPV_TYPE);
|
||||
}
|
||||
|
||||
@ -409,7 +409,7 @@ public class CertStore {
|
||||
*/
|
||||
public final static String getDefaultType() {
|
||||
String cstype;
|
||||
cstype = AccessController.doPrivileged(new PrivilegedAction<String>() {
|
||||
cstype = AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
public String run() {
|
||||
return Security.getProperty(CERTSTORE_TYPE);
|
||||
}
|
||||
|
||||
@ -231,7 +231,7 @@ public class CertificateRevokedException extends CertificateException {
|
||||
if (size == 0) {
|
||||
extensions = Collections.emptyMap();
|
||||
} else {
|
||||
extensions = new HashMap<String, Extension>(size);
|
||||
extensions = new HashMap<>(size);
|
||||
}
|
||||
|
||||
// Read in the extensions and put the mappings in the extensions map
|
||||
|
||||
@ -120,8 +120,8 @@ public class PKIXParameters implements CertPathParameters {
|
||||
setTrustAnchors(trustAnchors);
|
||||
|
||||
this.unmodInitialPolicies = Collections.<String>emptySet();
|
||||
this.certPathCheckers = new ArrayList<PKIXCertPathChecker>();
|
||||
this.certStores = new ArrayList<CertStore>();
|
||||
this.certPathCheckers = new ArrayList<>();
|
||||
this.certStores = new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -144,7 +144,7 @@ public class PKIXParameters implements CertPathParameters {
|
||||
if (keystore == null)
|
||||
throw new NullPointerException("the keystore parameter must be " +
|
||||
"non-null");
|
||||
Set<TrustAnchor> hashSet = new HashSet<TrustAnchor>();
|
||||
Set<TrustAnchor> hashSet = new HashSet<>();
|
||||
Enumeration<String> aliases = keystore.aliases();
|
||||
while (aliases.hasMoreElements()) {
|
||||
String alias = aliases.nextElement();
|
||||
@ -156,8 +156,8 @@ public class PKIXParameters implements CertPathParameters {
|
||||
}
|
||||
setTrustAnchors(hashSet);
|
||||
this.unmodInitialPolicies = Collections.<String>emptySet();
|
||||
this.certPathCheckers = new ArrayList<PKIXCertPathChecker>();
|
||||
this.certStores = new ArrayList<CertStore>();
|
||||
this.certPathCheckers = new ArrayList<>();
|
||||
this.certStores = new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -207,7 +207,7 @@ public class PKIXParameters implements CertPathParameters {
|
||||
}
|
||||
}
|
||||
this.unmodTrustAnchors = Collections.unmodifiableSet
|
||||
(new HashSet<TrustAnchor>(trustAnchors));
|
||||
(new HashSet<>(trustAnchors));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -256,7 +256,7 @@ public class PKIXParameters implements CertPathParameters {
|
||||
+ "of type java.lang.String");
|
||||
}
|
||||
this.unmodInitialPolicies =
|
||||
Collections.unmodifiableSet(new HashSet<String>(initialPolicies));
|
||||
Collections.unmodifiableSet(new HashSet<>(initialPolicies));
|
||||
} else
|
||||
this.unmodInitialPolicies = Collections.<String>emptySet();
|
||||
}
|
||||
@ -280,7 +280,7 @@ public class PKIXParameters implements CertPathParameters {
|
||||
*/
|
||||
public void setCertStores(List<CertStore> stores) {
|
||||
if (stores == null) {
|
||||
this.certStores = new ArrayList<CertStore>();
|
||||
this.certStores = new ArrayList<>();
|
||||
} else {
|
||||
for (Iterator<CertStore> i = stores.iterator(); i.hasNext();) {
|
||||
if (!(i.next() instanceof CertStore)) {
|
||||
@ -288,7 +288,7 @@ public class PKIXParameters implements CertPathParameters {
|
||||
+ "of type java.security.cert.CertStore");
|
||||
}
|
||||
}
|
||||
this.certStores = new ArrayList<CertStore>(stores);
|
||||
this.certStores = new ArrayList<>(stores);
|
||||
}
|
||||
}
|
||||
|
||||
@ -316,7 +316,7 @@ public class PKIXParameters implements CertPathParameters {
|
||||
*/
|
||||
public List<CertStore> getCertStores() {
|
||||
return Collections.unmodifiableList
|
||||
(new ArrayList<CertStore>(this.certStores));
|
||||
(new ArrayList<>(this.certStores));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -544,14 +544,13 @@ public class PKIXParameters implements CertPathParameters {
|
||||
*/
|
||||
public void setCertPathCheckers(List<PKIXCertPathChecker> checkers) {
|
||||
if (checkers != null) {
|
||||
List<PKIXCertPathChecker> tmpList =
|
||||
new ArrayList<PKIXCertPathChecker>();
|
||||
List<PKIXCertPathChecker> tmpList = new ArrayList<>();
|
||||
for (PKIXCertPathChecker checker : checkers) {
|
||||
tmpList.add((PKIXCertPathChecker)checker.clone());
|
||||
}
|
||||
this.certPathCheckers = tmpList;
|
||||
} else {
|
||||
this.certPathCheckers = new ArrayList<PKIXCertPathChecker>();
|
||||
this.certPathCheckers = new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
@ -567,7 +566,7 @@ public class PKIXParameters implements CertPathParameters {
|
||||
* @see #setCertPathCheckers
|
||||
*/
|
||||
public List<PKIXCertPathChecker> getCertPathCheckers() {
|
||||
List<PKIXCertPathChecker> tmpList = new ArrayList<PKIXCertPathChecker>();
|
||||
List<PKIXCertPathChecker> tmpList = new ArrayList<>();
|
||||
for (PKIXCertPathChecker ck : certPathCheckers) {
|
||||
tmpList.add((PKIXCertPathChecker)ck.clone());
|
||||
}
|
||||
@ -667,11 +666,11 @@ public class PKIXParameters implements CertPathParameters {
|
||||
|
||||
// must clone these because addCertStore, et al. modify them
|
||||
if (certStores != null) {
|
||||
copy.certStores = new ArrayList<CertStore>(certStores);
|
||||
copy.certStores = new ArrayList<>(certStores);
|
||||
}
|
||||
if (certPathCheckers != null) {
|
||||
copy.certPathCheckers =
|
||||
new ArrayList<PKIXCertPathChecker>(certPathCheckers.size());
|
||||
new ArrayList<>(certPathCheckers.size());
|
||||
for (PKIXCertPathChecker checker : certPathCheckers) {
|
||||
copy.certPathCheckers.add(
|
||||
(PKIXCertPathChecker)checker.clone());
|
||||
|
||||
@ -170,7 +170,7 @@ public abstract class PKIXRevocationChecker extends PKIXCertPathChecker {
|
||||
{
|
||||
this.ocspExtensions = (extensions == null)
|
||||
? Collections.<Extension>emptyList()
|
||||
: new ArrayList<Extension>(extensions);
|
||||
: new ArrayList<>(extensions);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -232,7 +232,7 @@ public abstract class PKIXRevocationChecker extends PKIXCertPathChecker {
|
||||
public void setOptions(Set<Option> options) {
|
||||
this.options = (options == null)
|
||||
? Collections.<Option>emptySet()
|
||||
: new HashSet<Option>(options);
|
||||
: new HashSet<>(options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -124,8 +124,8 @@ public class X509CRLSelector implements CRLSelector {
|
||||
issuerX500Principals = null;
|
||||
} else {
|
||||
// clone
|
||||
issuerX500Principals = new HashSet<X500Principal>(issuers);
|
||||
issuerNames = new HashSet<Object>();
|
||||
issuerX500Principals = new HashSet<>(issuers);
|
||||
issuerNames = new HashSet<>();
|
||||
for (X500Principal p : issuerX500Principals) {
|
||||
issuerNames.add(p.getEncoded());
|
||||
}
|
||||
@ -288,10 +288,10 @@ public class X509CRLSelector implements CRLSelector {
|
||||
*/
|
||||
private void addIssuerNameInternal(Object name, X500Principal principal) {
|
||||
if (issuerNames == null) {
|
||||
issuerNames = new HashSet<Object>();
|
||||
issuerNames = new HashSet<>();
|
||||
}
|
||||
if (issuerX500Principals == null) {
|
||||
issuerX500Principals = new HashSet<X500Principal>();
|
||||
issuerX500Principals = new HashSet<>();
|
||||
}
|
||||
issuerNames.add(name);
|
||||
issuerX500Principals.add(principal);
|
||||
@ -311,7 +311,7 @@ public class X509CRLSelector implements CRLSelector {
|
||||
private static HashSet<Object> cloneAndCheckIssuerNames(Collection<?> names)
|
||||
throws IOException
|
||||
{
|
||||
HashSet<Object> namesCopy = new HashSet<Object>();
|
||||
HashSet<Object> namesCopy = new HashSet<>();
|
||||
Iterator<?> i = names.iterator();
|
||||
while (i.hasNext()) {
|
||||
Object nameObject = i.next();
|
||||
@ -363,7 +363,7 @@ public class X509CRLSelector implements CRLSelector {
|
||||
*/
|
||||
private static HashSet<X500Principal> parseIssuerNames(Collection<Object> names)
|
||||
throws IOException {
|
||||
HashSet<X500Principal> x500Principals = new HashSet<X500Principal>();
|
||||
HashSet<X500Principal> x500Principals = new HashSet<>();
|
||||
for (Iterator<Object> t = names.iterator(); t.hasNext(); ) {
|
||||
Object nameObject = t.next();
|
||||
if (nameObject instanceof String) {
|
||||
@ -701,9 +701,9 @@ public class X509CRLSelector implements CRLSelector {
|
||||
X509CRLSelector copy = (X509CRLSelector)super.clone();
|
||||
if (issuerNames != null) {
|
||||
copy.issuerNames =
|
||||
new HashSet<Object>(issuerNames);
|
||||
new HashSet<>(issuerNames);
|
||||
copy.issuerX500Principals =
|
||||
new HashSet<X500Principal>(issuerX500Principals);
|
||||
new HashSet<>(issuerX500Principals);
|
||||
}
|
||||
return copy;
|
||||
} catch (CloneNotSupportedException e) {
|
||||
|
||||
@ -619,8 +619,8 @@ public class X509CertSelector implements CertSelector {
|
||||
keyPurposeOIDSet = null;
|
||||
} else {
|
||||
this.keyPurposeSet =
|
||||
Collections.unmodifiableSet(new HashSet<String>(keyPurposeSet));
|
||||
keyPurposeOIDSet = new HashSet<ObjectIdentifier>();
|
||||
Collections.unmodifiableSet(new HashSet<>(keyPurposeSet));
|
||||
keyPurposeOIDSet = new HashSet<>();
|
||||
for (String s : this.keyPurposeSet) {
|
||||
keyPurposeOIDSet.add(new ObjectIdentifier(s));
|
||||
}
|
||||
@ -815,12 +815,12 @@ public class X509CertSelector implements CertSelector {
|
||||
// First, ensure that the name parses
|
||||
GeneralNameInterface tempName = makeGeneralNameInterface(type, name);
|
||||
if (subjectAlternativeNames == null) {
|
||||
subjectAlternativeNames = new HashSet<List<?>>();
|
||||
subjectAlternativeNames = new HashSet<>();
|
||||
}
|
||||
if (subjectAlternativeGeneralNames == null) {
|
||||
subjectAlternativeGeneralNames = new HashSet<GeneralNameInterface>();
|
||||
subjectAlternativeGeneralNames = new HashSet<>();
|
||||
}
|
||||
List<Object> list = new ArrayList<Object>(2);
|
||||
List<Object> list = new ArrayList<>(2);
|
||||
list.add(Integer.valueOf(type));
|
||||
list.add(name);
|
||||
subjectAlternativeNames.add(list);
|
||||
@ -845,7 +845,7 @@ public class X509CertSelector implements CertSelector {
|
||||
* @throws IOException if a parsing error occurs
|
||||
*/
|
||||
private static Set<GeneralNameInterface> parseNames(Collection<List<?>> names) throws IOException {
|
||||
Set<GeneralNameInterface> genNames = new HashSet<GeneralNameInterface>();
|
||||
Set<GeneralNameInterface> genNames = new HashSet<>();
|
||||
for (List<?> nameList : names) {
|
||||
if (nameList.size() != 2) {
|
||||
throw new IOException("name list size not 2");
|
||||
@ -1096,10 +1096,10 @@ public class X509CertSelector implements CertSelector {
|
||||
} else {
|
||||
// Snapshot set and parse it
|
||||
Set<String> tempSet = Collections.unmodifiableSet
|
||||
(new HashSet<String>(certPolicySet));
|
||||
(new HashSet<>(certPolicySet));
|
||||
/* Convert to Vector of ObjectIdentifiers */
|
||||
Iterator<String> i = tempSet.iterator();
|
||||
Vector<CertificatePolicyId> polIdVector = new Vector<CertificatePolicyId>();
|
||||
Vector<CertificatePolicyId> polIdVector = new Vector<>();
|
||||
while (i.hasNext()) {
|
||||
Object o = i.next();
|
||||
if (!(o instanceof String)) {
|
||||
@ -1267,10 +1267,10 @@ public class X509CertSelector implements CertSelector {
|
||||
// First, ensure that the name parses
|
||||
GeneralNameInterface tempName = makeGeneralNameInterface(type, name);
|
||||
if (pathToGeneralNames == null) {
|
||||
pathToNames = new HashSet<List<?>>();
|
||||
pathToGeneralNames = new HashSet<GeneralNameInterface>();
|
||||
pathToNames = new HashSet<>();
|
||||
pathToGeneralNames = new HashSet<>();
|
||||
}
|
||||
List<Object> list = new ArrayList<Object>(2);
|
||||
List<Object> list = new ArrayList<>(2);
|
||||
list.add(Integer.valueOf(type));
|
||||
list.add(name);
|
||||
pathToNames.add(list);
|
||||
@ -1671,10 +1671,10 @@ public class X509CertSelector implements CertSelector {
|
||||
*/
|
||||
private static Set<List<?>> cloneAndCheckNames(Collection<List<?>> names) throws IOException {
|
||||
// Copy the Lists and Collection
|
||||
Set<List<?>> namesCopy = new HashSet<List<?>>();
|
||||
Set<List<?>> namesCopy = new HashSet<>();
|
||||
for (List<?> o : names)
|
||||
{
|
||||
namesCopy.add(new ArrayList<Object>(o));
|
||||
namesCopy.add(new ArrayList<>(o));
|
||||
}
|
||||
|
||||
// Check the contents of the Lists and clone any byte arrays
|
||||
@ -2397,7 +2397,7 @@ public class X509CertSelector implements CertSelector {
|
||||
* Convert the Vector of PolicyInformation to a Vector
|
||||
* of CertificatePolicyIds for easier comparison.
|
||||
*/
|
||||
List<CertificatePolicyId> policyIDs = new ArrayList<CertificatePolicyId>(policies.size());
|
||||
List<CertificatePolicyId> policyIDs = new ArrayList<>(policies.size());
|
||||
for (PolicyInformation info : policies) {
|
||||
policyIDs.add(info.getPolicyIdentifier());
|
||||
}
|
||||
|
||||
@ -76,7 +76,7 @@ final class JceSecurity {
|
||||
static {
|
||||
try {
|
||||
AccessController.doPrivileged(
|
||||
new PrivilegedExceptionAction<Void> () {
|
||||
new PrivilegedExceptionAction<> () {
|
||||
@Override
|
||||
public Void run() throws Exception {
|
||||
setupJurisdictionPolicies();
|
||||
@ -225,7 +225,7 @@ final class JceSecurity {
|
||||
URL url = codeBaseCacheRef.get(clazz);
|
||||
if (url == null) {
|
||||
url = AccessController.doPrivileged(
|
||||
new PrivilegedAction<URL>() {
|
||||
new PrivilegedAction<>() {
|
||||
@Override
|
||||
public URL run() {
|
||||
ProtectionDomain pd = clazz.getProtectionDomain();
|
||||
|
||||
@ -66,7 +66,7 @@ final class JceSecurityManager extends SecurityManager {
|
||||
exemptPolicy = JceSecurity.getExemptPolicy();
|
||||
allPerm = CryptoAllPermission.INSTANCE;
|
||||
INSTANCE = AccessController.doPrivileged(
|
||||
new PrivilegedAction<JceSecurityManager>() {
|
||||
new PrivilegedAction<>() {
|
||||
public JceSecurityManager run() {
|
||||
return new JceSecurityManager();
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ public class KeyManagerFactory {
|
||||
*/
|
||||
public final static String getDefaultAlgorithm() {
|
||||
String type;
|
||||
type = AccessController.doPrivileged(new PrivilegedAction<String>() {
|
||||
type = AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
public String run() {
|
||||
return Security.getProperty(
|
||||
|
||||
@ -126,7 +126,7 @@ public abstract class SSLSocketFactory extends SocketFactory
|
||||
}
|
||||
|
||||
static String getSecurityProperty(final String name) {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<String>() {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
public String run() {
|
||||
String s = java.security.Security.getProperty(name);
|
||||
|
||||
@ -63,7 +63,7 @@ public class TrustManagerFactory {
|
||||
*/
|
||||
public final static String getDefaultAlgorithm() {
|
||||
String type;
|
||||
type = AccessController.doPrivileged(new PrivilegedAction<String>() {
|
||||
type = AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
public String run() {
|
||||
return Security.getProperty(
|
||||
|
||||
@ -154,11 +154,11 @@ public final class Subject implements java.io.Serializable {
|
||||
public Subject() {
|
||||
|
||||
this.principals = Collections.synchronizedSet
|
||||
(new SecureSet<Principal>(this, PRINCIPAL_SET));
|
||||
(new SecureSet<>(this, PRINCIPAL_SET));
|
||||
this.pubCredentials = Collections.synchronizedSet
|
||||
(new SecureSet<Object>(this, PUB_CREDENTIAL_SET));
|
||||
(new SecureSet<>(this, PUB_CREDENTIAL_SET));
|
||||
this.privCredentials = Collections.synchronizedSet
|
||||
(new SecureSet<Object>(this, PRIV_CREDENTIAL_SET));
|
||||
(new SecureSet<>(this, PRIV_CREDENTIAL_SET));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -206,11 +206,11 @@ public final class Subject implements java.io.Serializable {
|
||||
collectionNullClean(pubCredentials);
|
||||
collectionNullClean(privCredentials);
|
||||
|
||||
this.principals = Collections.synchronizedSet(new SecureSet<Principal>
|
||||
this.principals = Collections.synchronizedSet(new SecureSet<>
|
||||
(this, PRINCIPAL_SET, principals));
|
||||
this.pubCredentials = Collections.synchronizedSet(new SecureSet<Object>
|
||||
this.pubCredentials = Collections.synchronizedSet(new SecureSet<>
|
||||
(this, PUB_CREDENTIAL_SET, pubCredentials));
|
||||
this.privCredentials = Collections.synchronizedSet(new SecureSet<Object>
|
||||
this.privCredentials = Collections.synchronizedSet(new SecureSet<>
|
||||
(this, PRIV_CREDENTIAL_SET, privCredentials));
|
||||
this.readOnly = readOnly;
|
||||
}
|
||||
@ -292,7 +292,7 @@ public final class Subject implements java.io.Serializable {
|
||||
|
||||
// return the Subject from the DomainCombiner of the provided context
|
||||
return AccessController.doPrivileged
|
||||
(new java.security.PrivilegedAction<Subject>() {
|
||||
(new java.security.PrivilegedAction<>() {
|
||||
public Subject run() {
|
||||
DomainCombiner dc = acc.getDomainCombiner();
|
||||
if (!(dc instanceof SubjectDomainCombiner)) {
|
||||
@ -555,7 +555,7 @@ public final class Subject implements java.io.Serializable {
|
||||
|
||||
|
||||
return java.security.AccessController.doPrivileged
|
||||
(new java.security.PrivilegedAction<AccessControlContext>() {
|
||||
(new java.security.PrivilegedAction<>() {
|
||||
public AccessControlContext run() {
|
||||
if (subject == null) {
|
||||
return new AccessControlContext(acc, null);
|
||||
@ -801,7 +801,7 @@ public final class Subject implements java.io.Serializable {
|
||||
Set<Principal> thatPrincipals;
|
||||
synchronized(that.principals) {
|
||||
// avoid deadlock from dual locks
|
||||
thatPrincipals = new HashSet<Principal>(that.principals);
|
||||
thatPrincipals = new HashSet<>(that.principals);
|
||||
}
|
||||
if (!principals.equals(thatPrincipals)) {
|
||||
return false;
|
||||
@ -810,7 +810,7 @@ public final class Subject implements java.io.Serializable {
|
||||
Set<Object> thatPubCredentials;
|
||||
synchronized(that.pubCredentials) {
|
||||
// avoid deadlock from dual locks
|
||||
thatPubCredentials = new HashSet<Object>(that.pubCredentials);
|
||||
thatPubCredentials = new HashSet<>(that.pubCredentials);
|
||||
}
|
||||
if (!pubCredentials.equals(thatPubCredentials)) {
|
||||
return false;
|
||||
@ -819,7 +819,7 @@ public final class Subject implements java.io.Serializable {
|
||||
Set<Object> thatPrivCredentials;
|
||||
synchronized(that.privCredentials) {
|
||||
// avoid deadlock from dual locks
|
||||
thatPrivCredentials = new HashSet<Object>(that.privCredentials);
|
||||
thatPrivCredentials = new HashSet<>(that.privCredentials);
|
||||
}
|
||||
if (!privCredentials.equals(thatPrivCredentials)) {
|
||||
return false;
|
||||
@ -970,21 +970,21 @@ public final class Subject implements java.io.Serializable {
|
||||
|
||||
// Rewrap the principals into a SecureSet
|
||||
try {
|
||||
principals = Collections.synchronizedSet(new SecureSet<Principal>
|
||||
principals = Collections.synchronizedSet(new SecureSet<>
|
||||
(this, PRINCIPAL_SET, inputPrincs));
|
||||
} catch (NullPointerException npe) {
|
||||
// Sometimes people deserialize the principals set only.
|
||||
// Subject is not accessible, so just don't fail.
|
||||
principals = Collections.synchronizedSet
|
||||
(new SecureSet<Principal>(this, PRINCIPAL_SET));
|
||||
(new SecureSet<>(this, PRINCIPAL_SET));
|
||||
}
|
||||
|
||||
// The Credential {@code Set} is not serialized, but we do not
|
||||
// want the default deserialization routine to set it to null.
|
||||
this.pubCredentials = Collections.synchronizedSet
|
||||
(new SecureSet<Object>(this, PUB_CREDENTIAL_SET));
|
||||
(new SecureSet<>(this, PUB_CREDENTIAL_SET));
|
||||
this.privCredentials = Collections.synchronizedSet
|
||||
(new SecureSet<Object>(this, PRIV_CREDENTIAL_SET));
|
||||
(new SecureSet<>(this, PRIV_CREDENTIAL_SET));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1497,7 +1497,7 @@ public final class Subject implements java.io.Serializable {
|
||||
Object next;
|
||||
if (which == Subject.PRIV_CREDENTIAL_SET) {
|
||||
next = java.security.AccessController.doPrivileged
|
||||
(new java.security.PrivilegedAction<Object>() {
|
||||
(new java.security.PrivilegedAction<>() {
|
||||
public Object run() {
|
||||
return iterator.next();
|
||||
}
|
||||
|
||||
@ -229,7 +229,7 @@ public abstract class Configuration {
|
||||
if (configuration == null) {
|
||||
String config_class = null;
|
||||
config_class = AccessController.doPrivileged
|
||||
(new PrivilegedAction<String>() {
|
||||
(new PrivilegedAction<>() {
|
||||
public String run() {
|
||||
return java.security.Security.getProperty
|
||||
("login.configuration.provider");
|
||||
@ -242,7 +242,7 @@ public abstract class Configuration {
|
||||
try {
|
||||
final String finalClass = config_class;
|
||||
Configuration untrustedImpl = AccessController.doPrivileged(
|
||||
new PrivilegedExceptionAction<Configuration>() {
|
||||
new PrivilegedExceptionAction<>() {
|
||||
public Configuration run() throws ClassNotFoundException,
|
||||
InstantiationException,
|
||||
IllegalAccessException {
|
||||
@ -254,7 +254,7 @@ public abstract class Configuration {
|
||||
}
|
||||
});
|
||||
AccessController.doPrivileged(
|
||||
new PrivilegedExceptionAction<Void>() {
|
||||
new PrivilegedExceptionAction<>() {
|
||||
public Void run() {
|
||||
setConfiguration(untrustedImpl);
|
||||
return null;
|
||||
|
||||
@ -142,7 +142,7 @@ public abstract class X509Certificate extends Certificate {
|
||||
|
||||
static {
|
||||
X509Provider = AccessController.doPrivileged(
|
||||
new PrivilegedAction<String>() {
|
||||
new PrivilegedAction<>() {
|
||||
public String run() {
|
||||
return Security.getProperty(X509_PROVIDER);
|
||||
}
|
||||
|
||||
@ -530,7 +530,7 @@ public class PKCS7 {
|
||||
// CRLs (optional)
|
||||
if (crls != null && crls.length != 0) {
|
||||
// cast to X509CRLImpl[] since X509CRLImpl implements DerEncoder
|
||||
Set<X509CRLImpl> implCRLs = new HashSet<X509CRLImpl>(crls.length);
|
||||
Set<X509CRLImpl> implCRLs = new HashSet<>(crls.length);
|
||||
for (X509CRL crl: crls) {
|
||||
if (crl instanceof X509CRLImpl)
|
||||
implCRLs.add((X509CRLImpl) crl);
|
||||
@ -590,7 +590,7 @@ public class PKCS7 {
|
||||
public SignerInfo[] verify(byte[] bytes)
|
||||
throws NoSuchAlgorithmException, SignatureException {
|
||||
|
||||
Vector<SignerInfo> intResult = new Vector<SignerInfo>();
|
||||
Vector<SignerInfo> intResult = new Vector<>();
|
||||
for (int i = 0; i < signerInfos.length; i++) {
|
||||
|
||||
SignerInfo signerInfo = verify(signerInfos[i], bytes);
|
||||
|
||||
@ -85,8 +85,7 @@ public class PKCS9Attributes {
|
||||
DerInputStream in) throws IOException {
|
||||
if (permittedAttributes != null) {
|
||||
this.permittedAttributes =
|
||||
new Hashtable<ObjectIdentifier, ObjectIdentifier>(
|
||||
permittedAttributes.length);
|
||||
new Hashtable<>(permittedAttributes.length);
|
||||
|
||||
for (int i = 0; i < permittedAttributes.length; i++)
|
||||
this.permittedAttributes.put(permittedAttributes[i],
|
||||
|
||||
@ -237,7 +237,7 @@ public class SignerInfo implements DerEncoder {
|
||||
if (userCert == null)
|
||||
return null;
|
||||
|
||||
ArrayList<X509Certificate> certList = new ArrayList<X509Certificate>();
|
||||
ArrayList<X509Certificate> certList = new ArrayList<>();
|
||||
certList.add(userCert);
|
||||
|
||||
X509Certificate[] pkcsCerts = block.getCertificates();
|
||||
|
||||
@ -165,7 +165,7 @@ abstract class SeedGenerator {
|
||||
md.update(b);
|
||||
|
||||
java.security.AccessController.doPrivileged
|
||||
(new java.security.PrivilegedAction<Void>() {
|
||||
(new java.security.PrivilegedAction<>() {
|
||||
@Override
|
||||
public Void run() {
|
||||
try {
|
||||
@ -295,7 +295,7 @@ abstract class SeedGenerator {
|
||||
|
||||
final ThreadGroup[] finalsg = new ThreadGroup[1];
|
||||
Thread t = java.security.AccessController.doPrivileged
|
||||
(new java.security.PrivilegedAction<Thread>() {
|
||||
(new java.security.PrivilegedAction<>() {
|
||||
@Override
|
||||
public Thread run() {
|
||||
ThreadGroup parent, group =
|
||||
@ -501,7 +501,7 @@ abstract class SeedGenerator {
|
||||
final URL device = new URL(deviceName);
|
||||
try {
|
||||
seedStream = java.security.AccessController.doPrivileged
|
||||
(new java.security.PrivilegedExceptionAction<InputStream>() {
|
||||
(new java.security.PrivilegedExceptionAction<>() {
|
||||
@Override
|
||||
public InputStream run() throws IOException {
|
||||
/*
|
||||
|
||||
@ -148,7 +148,7 @@ public abstract class SunJSSE extends java.security.Provider {
|
||||
}
|
||||
|
||||
private void registerAlgorithms(final boolean isfips) {
|
||||
AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
||||
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
public Object run() {
|
||||
doRegister(isfips);
|
||||
|
||||
@ -394,7 +394,7 @@ public class DerInputStream {
|
||||
/*
|
||||
* Pull values out of the stream.
|
||||
*/
|
||||
Vector<DerValue> vec = new Vector<DerValue>(startLen);
|
||||
Vector<DerValue> vec = new Vector<>(startLen);
|
||||
DerValue value;
|
||||
|
||||
do {
|
||||
|
||||
@ -110,7 +110,7 @@ public class ManifestDigester {
|
||||
public ManifestDigester(byte bytes[])
|
||||
{
|
||||
rawBytes = bytes;
|
||||
entries = new HashMap<String, Entry>();
|
||||
entries = new HashMap<>();
|
||||
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
|
||||
|
||||
@ -77,9 +77,9 @@ public class ManifestEntryVerifier {
|
||||
*/
|
||||
public ManifestEntryVerifier(Manifest man)
|
||||
{
|
||||
createdDigests = new HashMap<String, MessageDigest>(11);
|
||||
digests = new ArrayList<MessageDigest>();
|
||||
manifestHashes = new ArrayList<byte[]>();
|
||||
createdDigests = new HashMap<>(11);
|
||||
digests = new ArrayList<>();
|
||||
manifestHashes = new ArrayList<>();
|
||||
this.man = man;
|
||||
}
|
||||
|
||||
|
||||
@ -203,7 +203,7 @@ public class SignatureFileVerifier {
|
||||
private MessageDigest getDigest(String algorithm)
|
||||
{
|
||||
if (createdDigests == null)
|
||||
createdDigests = new HashMap<String, MessageDigest>();
|
||||
createdDigests = new HashMap<>();
|
||||
|
||||
MessageDigest digest = createdDigests.get(algorithm);
|
||||
|
||||
@ -523,7 +523,7 @@ public class SignatureFileVerifier {
|
||||
ArrayList<X509Certificate> chain = info.getCertificateChain(block);
|
||||
CertPath certChain = certificateFactory.generateCertPath(chain);
|
||||
if (signers == null) {
|
||||
signers = new ArrayList<CodeSigner>();
|
||||
signers = new ArrayList<>();
|
||||
}
|
||||
// Append the new code signer
|
||||
signers.add(new CodeSigner(certChain, info.getTimestamp()));
|
||||
|
||||
@ -307,7 +307,7 @@ public class AVA implements DerEncoder {
|
||||
// doublequote.
|
||||
int c = readChar(in, "Quoted string did not end in quote");
|
||||
|
||||
List<Byte> embeddedHex = new ArrayList<Byte>();
|
||||
List<Byte> embeddedHex = new ArrayList<>();
|
||||
boolean isPrintableString = true;
|
||||
while (c != '"') {
|
||||
if (c == '\\') {
|
||||
|
||||
@ -571,7 +571,7 @@ public class AlgorithmId implements Serializable, DerEncoder {
|
||||
break;
|
||||
}
|
||||
if (oidTable == null) {
|
||||
oidTable = new HashMap<String,ObjectIdentifier>();
|
||||
oidTable = new HashMap<>();
|
||||
}
|
||||
oidString = alias.substring(index);
|
||||
String stdAlgName = provs[i].getProperty(alias);
|
||||
@ -588,7 +588,7 @@ public class AlgorithmId implements Serializable, DerEncoder {
|
||||
}
|
||||
|
||||
if (oidTable == null) {
|
||||
oidTable = new HashMap<String,ObjectIdentifier>(1);
|
||||
oidTable = new HashMap<>(1);
|
||||
}
|
||||
initOidTable = true;
|
||||
}
|
||||
@ -887,7 +887,7 @@ public class AlgorithmId implements Serializable, DerEncoder {
|
||||
*/
|
||||
sha1WithDSA_oid = ObjectIdentifier.newInternal(dsaWithSHA1_PKIX_data);
|
||||
|
||||
nameTable = new HashMap<ObjectIdentifier,String>();
|
||||
nameTable = new HashMap<>();
|
||||
nameTable.put(MD5_oid, "MD5");
|
||||
nameTable.put(MD2_oid, "MD2");
|
||||
nameTable.put(SHA_oid, "SHA-1");
|
||||
|
||||
@ -58,7 +58,7 @@ public class CertificatePolicySet {
|
||||
* @exception IOException on decoding errors.
|
||||
*/
|
||||
public CertificatePolicySet(DerInputStream in) throws IOException {
|
||||
ids = new Vector<CertificatePolicyId>();
|
||||
ids = new Vector<>();
|
||||
DerValue[] seq = in.getSequence(5);
|
||||
|
||||
for (int i = 0; i < seq.length; i++) {
|
||||
|
||||
@ -59,11 +59,11 @@ public class GeneralSubtrees implements Cloneable {
|
||||
* The default constructor for the class.
|
||||
*/
|
||||
public GeneralSubtrees() {
|
||||
trees = new ArrayList<GeneralSubtree>();
|
||||
trees = new ArrayList<>();
|
||||
}
|
||||
|
||||
private GeneralSubtrees(GeneralSubtrees source) {
|
||||
trees = new ArrayList<GeneralSubtree>(source.trees);
|
||||
trees = new ArrayList<>(source.trees);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -102,7 +102,7 @@ public class RDN {
|
||||
int quoteCount = 0;
|
||||
int searchOffset = 0;
|
||||
int avaOffset = 0;
|
||||
List<AVA> avaVec = new ArrayList<AVA>(3);
|
||||
List<AVA> avaVec = new ArrayList<>(3);
|
||||
int nextPlus = name.indexOf('+');
|
||||
while (nextPlus >= 0) {
|
||||
quoteCount += X500Name.countQuotes(name, searchOffset, nextPlus);
|
||||
@ -182,7 +182,7 @@ public class RDN {
|
||||
}
|
||||
int searchOffset = 0;
|
||||
int avaOffset = 0;
|
||||
List<AVA> avaVec = new ArrayList<AVA>(3);
|
||||
List<AVA> avaVec = new ArrayList<>(3);
|
||||
int nextPlus = name.indexOf('+');
|
||||
while (nextPlus >= 0) {
|
||||
/*
|
||||
@ -453,7 +453,7 @@ public class RDN {
|
||||
} else {
|
||||
// order the string type AVA's alphabetically,
|
||||
// followed by the oid type AVA's numerically
|
||||
List<AVA> avaList = new ArrayList<AVA>(assertion.length);
|
||||
List<AVA> avaList = new ArrayList<>(assertion.length);
|
||||
for (int i = 0; i < assertion.length; i++) {
|
||||
avaList.add(assertion[i]);
|
||||
}
|
||||
|
||||
@ -342,7 +342,7 @@ public class X500Name implements GeneralNameInterface, Principal {
|
||||
public List<AVA> allAvas() {
|
||||
List<AVA> list = allAvaList;
|
||||
if (list == null) {
|
||||
list = new ArrayList<AVA>();
|
||||
list = new ArrayList<>();
|
||||
for (int i = 0; i < names.length; i++) {
|
||||
list.addAll(names[i].avas());
|
||||
}
|
||||
@ -1382,7 +1382,7 @@ public class X500Name implements GeneralNameInterface, Principal {
|
||||
*/
|
||||
static {
|
||||
PrivilegedExceptionAction<Object[]> pa =
|
||||
new PrivilegedExceptionAction<Object[]>() {
|
||||
new PrivilegedExceptionAction<>() {
|
||||
public Object[] run() throws Exception {
|
||||
Class<X500Principal> pClass = X500Principal.class;
|
||||
Class<?>[] args = new Class<?>[] { X500Name.class };
|
||||
|
||||
@ -125,7 +125,7 @@ public final class NativePRNG extends SecureRandomSpi {
|
||||
*/
|
||||
private static RandomIO initIO(final Variant v) {
|
||||
return AccessController.doPrivileged(
|
||||
new PrivilegedAction<RandomIO>() {
|
||||
new PrivilegedAction<>() {
|
||||
@Override
|
||||
public RandomIO run() {
|
||||
|
||||
@ -440,7 +440,7 @@ public final class NativePRNG extends SecureRandomSpi {
|
||||
if (seedOutInitialized == false) {
|
||||
seedOutInitialized = true;
|
||||
seedOut = AccessController.doPrivileged(
|
||||
new PrivilegedAction<OutputStream>() {
|
||||
new PrivilegedAction<>() {
|
||||
@Override
|
||||
public OutputStream run() {
|
||||
try {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user