--- a/src/java.base/share/classes/sun/security/provider/VerificationProvider.java Thu Dec 13 08:23:56 2018 +0800
+++ b/src/java.base/share/classes/sun/security/provider/VerificationProvider.java Thu Dec 13 01:15:21 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2018, 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
@@ -28,8 +28,6 @@
import java.util.*;
import java.security.*;
-import sun.security.action.PutAllAction;
-
import sun.security.rsa.SunRsaSignEntries;
import static sun.security.util.SecurityConstants.PROVIDER_VER;
@@ -70,18 +68,30 @@
return;
}
+ Provider p = this;
+ Iterator<Provider.Service> sunIter = new SunEntries(p).iterator();
+ Iterator<Provider.Service> rsaIter =
+ new SunRsaSignEntries(p).iterator();
+
// if there is no security manager installed, put directly into
- // the provider. Otherwise, create a temporary map and use a
- // doPrivileged() call at the end to transfer the contents
+ // the provider
if (System.getSecurityManager() == null) {
- SunEntries.putEntries(this);
- SunRsaSignEntries.putEntries(this);
+ putEntries(sunIter);
+ putEntries(rsaIter);
} else {
- // use LinkedHashMap to preserve the order of the PRNGs
- Map<Object, Object> map = new LinkedHashMap<>();
- SunEntries.putEntries(map);
- SunRsaSignEntries.putEntries(map);
- AccessController.doPrivileged(new PutAllAction(this, map));
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Void run() {
+ putEntries(sunIter);
+ putEntries(rsaIter);
+ return null;
+ }
+ });
+ }
+ }
+
+ void putEntries(Iterator<Provider.Service> i) {
+ while (i.hasNext()) {
+ putService(i.next());
}
}