changeset 12431:e29445ea46e4

8179515: Class java.util.concurrent.ThreadLocalRandom fails to Initialize when using SecurityManager Reviewed-by: dholmes, rriggs
author dl
date Wed, 17 May 2017 09:17:53 -0400
parents bc066bc4b7ee
children c0048bbca98a
files src/share/classes/java/util/concurrent/ThreadLocalRandom.java
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/util/concurrent/ThreadLocalRandom.java	Wed May 17 13:37:52 2017 +0300
+++ b/src/share/classes/java/util/concurrent/ThreadLocalRandom.java	Wed May 17 09:17:53 2017 -0400
@@ -47,6 +47,7 @@
 import java.util.stream.IntStream;
 import java.util.stream.LongStream;
 import java.util.stream.StreamSupport;
+import sun.misc.VM;
 
 /**
  * A random number generator isolated to the current thread.  Like the
@@ -135,10 +136,8 @@
     private static final AtomicLong seeder = new AtomicLong(initialSeed());
 
     private static long initialSeed() {
-        String pp = java.security.AccessController.doPrivileged(
-                new sun.security.action.GetPropertyAction(
-                        "java.util.secureRandomSeed"));
-        if (pp != null && pp.equalsIgnoreCase("true")) {
+        String sec = VM.getSavedProperty("java.util.secureRandomSeed");
+        if (Boolean.parseBoolean(sec)) {
             byte[] seedBytes = java.security.SecureRandom.getSeed(8);
             long s = (long)(seedBytes[0]) & 0xffL;
             for (int i = 1; i < 8; ++i)