Skip to content

Commit

Permalink
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions core/src/main/java/org/jruby/runtime/ThreadContext.java
Original file line number Diff line number Diff line change
@@ -141,6 +141,7 @@ public static ThreadContext newContext(Ruby runtime) {
public transient SecureRandom secureRandom;

private static boolean tryPreferredPRNG = true;
private static boolean trySHA1PRNG = true;

public final JavaSites sites;

@@ -156,6 +157,13 @@ public SecureRandom getSecureRandom() {
}
}
if (secureRandom == null) {
if (trySHA1PRNG) {
try {
secureRandom = SecureRandom.getInstance("SHA1PRNG");
} catch (Exception e) {
trySHA1PRNG = false;
}
}
secureRandom = new SecureRandom();
}
this.secureRandom = secureRandom;
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/util/cli/Options.java
Original file line number Diff line number Diff line change
@@ -166,7 +166,7 @@ public class Options {
public static final Option<Boolean> FCNTL_LOCKING = bool(MISCELLANEOUS, "file.flock.fcntl", true, "Use fcntl rather than flock for File#flock");
public static final Option<Boolean> VOLATILE_VARIABLES = bool(MISCELLANEOUS, "volatile.variables", true, "Always ensure volatile semantics for instance variables.");
public static final Option<Boolean> RECORD_LEXICAL_HIERARCHY = bool(MISCELLANEOUS, "record.lexical.hierarchy", false, "Maintain children static scopes to support scope dumping.");
public static final Option<String> PREFERRED_PRNG = string(MISCELLANEOUS, "preferred.prng", "SHA1PRNG", "Maintain children static scopes to support scope dumping.");
public static final Option<String> PREFERRED_PRNG = string(MISCELLANEOUS, "preferred.prng", "NativePRNGNonBlocking", "Maintain children static scopes to support scope dumping.");

public static final Option<Boolean> DEBUG_LOADSERVICE = bool(DEBUG, "debug.loadService", false, "Log require/load file searches.");
public static final Option<Boolean> DEBUG_LOADSERVICE_TIMING = bool(DEBUG, "debug.loadService.timing", false, "Log require/load parse+evaluate times.");

0 comments on commit 061903e

Please sign in to comment.