commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r906769 - /commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/JVMRandom.java
Date Fri, 05 Feb 2010 02:18:01 GMT
Author: sebb
Date: Fri Feb  5 02:18:00 2010
New Revision: 906769

URL: http://svn.apache.org/viewvc?rev=906769&view=rev
Log:
Oops! Need to revert r906694 as Random ctor calls setSeed

Modified:
    commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/JVMRandom.java

Modified: commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/JVMRandom.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/JVMRandom.java?rev=906769&r1=906768&r2=906769&view=diff
==============================================================================
--- commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/JVMRandom.java
(original)
+++ commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/JVMRandom.java
Fri Feb  5 02:18:00 2010
@@ -44,9 +44,15 @@
     private static final Random SHARED_RANDOM = new Random();
 
     /**
+     * Ensures that only the parent constructor can call reseed.
+     */
+    private boolean constructed = false;
+
+    /**
      * Constructs a new instance.
      */
     public JVMRandom() {
+        this.constructed = true;
     }
     
     /**
@@ -56,7 +62,9 @@
      * @throws UnsupportedOperationException
      */
     public synchronized void setSeed(long seed) {
-        throw new UnsupportedOperationException();
+        if (this.constructed) {
+            throw new UnsupportedOperationException();
+        }
     }
 
     /**



Mime
View raw message