8046368: Code cleanup in SeedGenerator.java
Reviewed-by: mullan
Contributed-by: Jamil Nimeh <jamil.j.nimeh@oracle.com>
--- 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());
}