8046368: Code cleanup in SeedGenerator.java
authorascarpino
Tue, 10 Jun 2014 14:17:32 -0700
changeset 24864 a7bf63ebda64
parent 24863 bf6df3caafe4
child 24865 09b1d992ca72
8046368: Code cleanup in SeedGenerator.java Reviewed-by: mullan Contributed-by: Jamil Nimeh <jamil.j.nimeh@oracle.com>
jdk/src/share/classes/sun/security/provider/SeedGenerator.java
--- a/jdk/src/share/classes/sun/security/provider/SeedGenerator.java	Tue Jun 10 12:04:42 2014 -0700
+++ b/jdk/src/share/classes/sun/security/provider/SeedGenerator.java	Tue Jun 10 14:17:32 2014 -0700
@@ -150,14 +150,13 @@
      * Retrieve some system information, hashed.
      */
     static byte[] getSystemEntropy() {
-        byte[] ba;
         final MessageDigest md;
 
         try {
             md = MessageDigest.getInstance("SHA");
         } catch (NoSuchAlgorithmException nsae) {
-            throw new InternalError("internal error: SHA-1 not available."
-                    , nsae);
+            throw new InternalError("internal error: SHA-1 not available.",
+                    nsae);
         }
 
         // The current time in millis
@@ -170,11 +169,8 @@
                 public Void run() {
                     try {
                         // System properties can change from machine to machine
-                        String s;
                         Properties p = System.getProperties();
-                        Enumeration<?> e = p.propertyNames();
-                        while (e.hasMoreElements()) {
-                            s =(String)e.nextElement();
+                        for (String s: p.stringPropertyNames()) {
                             md.update(s.getBytes());
                             md.update(p.getProperty(s).getBytes());
                         }