You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by st...@apache.org on 2004/05/17 18:48:56 UTC
cvs commit: ws-axis/java/src/org/apache/axis/utils SessionUtils.java
stevel 2004/05/17 09:48:56
Modified: java/src/org/apache/axis/utils SessionUtils.java
Log:
stop generating non-random seeds and hope whoever wrote the random class does a better job.
You are only meant to seed the classes when you have some very random source like a neutrino detector, and even then you need to be sure that someone devious anywhere on the planet with the right equipment (a particle accellerator and a lump of beryllium) isnt manipulating the neutrino flux.
Revision Changes Path
1.10 +0 -26 ws-axis/java/src/org/apache/axis/utils/SessionUtils.java
Index: SessionUtils.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/utils/SessionUtils.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- SessionUtils.java 14 May 2004 12:56:13 -0000 1.9
+++ SessionUtils.java 17 May 2004 16:48:56 -0000 1.10
@@ -102,17 +102,7 @@
if (random == null) {
try {
Class clazz = Class.forName(randomClass);
-
random = (Random) clazz.newInstance();
- long seed = System.currentTimeMillis();
- char entropy[] = getEntropy().toCharArray();
-
- for (int i = 0; i < entropy.length; i++) {
- long update = ((byte) entropy[i]) << ((i % 8) * 8);
-
- seed ^= update;
- }
- random.setSeed(seed);
} catch (Exception e) {
random = new java.util.Random();
}
@@ -120,20 +110,4 @@
return (random);
}
- /**
- * Method getEntropy
- *
- * @return a nominally unique string
- */
- private static String getEntropy() {
- if (null == thisHost) {
- thisHost=NetworkUtils.getLocalHostname();
- }
- StringBuffer s = new StringBuffer();
-
- // Unique string
- s.append(s.hashCode()).append('.').append(System.currentTimeMillis())
- .append(".AXIS@").append(thisHost);
- return s.toString();
- }
}