diff options
Diffstat (limited to 'libjava/java/security/SecureRandom.java')
-rw-r--r-- | libjava/java/security/SecureRandom.java | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/libjava/java/security/SecureRandom.java b/libjava/java/security/SecureRandom.java index d7fda7b..5e410c0 100644 --- a/libjava/java/security/SecureRandom.java +++ b/libjava/java/security/SecureRandom.java @@ -87,7 +87,7 @@ public class SecureRandom extends Random */ public SecureRandom() { - Provider p[] = Security.getProviders(); + Provider[] p = Security.getProviders(); //Format of Key: SecureRandom.algname String key; @@ -112,7 +112,10 @@ public class SecureRandom extends Random provider = p[i]; return; } - catch (Throwable ignore) { } + catch (Throwable t) + { + // Ignore. + } } } } @@ -167,18 +170,20 @@ public class SecureRandom extends Random * @throws NoSuchAlgorithmException If no installed provider implements * the given algorithm. */ - public static SecureRandom getInstance(String algorithm) throws - NoSuchAlgorithmException + public static SecureRandom getInstance(String algorithm) + throws NoSuchAlgorithmException { - Provider p[] = Security.getProviders(); + Provider[] p = Security.getProviders(); + for (int i = 0; i < p.length; i++) { try { return getInstance(algorithm, p[i]); } - catch (NoSuchAlgorithmException ignored) + catch (NoSuchAlgorithmException e) { + // Ignore. } } @@ -284,7 +289,7 @@ public class SecureRandom extends Random // Therefore we test. if (secureRandomSpi != null) { - byte tmp[] = { (byte) (0xff & (seed >> 56)), + byte[] tmp = { (byte) (0xff & (seed >> 56)), (byte) (0xff & (seed >> 48)), (byte) (0xff & (seed >> 40)), (byte) (0xff & (seed >> 32)), @@ -324,7 +329,7 @@ public class SecureRandom extends Random if (numBits == 0) return 0; - byte tmp[] = new byte[numBits / 8 + (1 * (numBits % 8))]; + byte[] tmp = new byte[numBits / 8 + (1 * (numBits % 8))]; secureRandomSpi.engineNextBytes(tmp); randomBytesUsed += tmp.length; @@ -349,7 +354,7 @@ public class SecureRandom extends Random */ public static byte[] getSeed(int numBytes) { - byte tmp[] = new byte[numBytes]; + byte[] tmp = new byte[numBytes]; new Random().nextBytes(tmp); return tmp; |