You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by ka...@apache.org on 2013/04/24 09:32:16 UTC

svn commit: r1471275 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURQueryMixTest.java

Author: kahatlen
Date: Wed Apr 24 07:32:16 2013
New Revision: 1471275

URL: http://svn.apache.org/r1471275
Log:
DERBY-6196: ArrayIndexOutOfBoundsException in SURQueryMixTest

Make sure the random array index is never negative.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURQueryMixTest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURQueryMixTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURQueryMixTest.java?rev=1471275&r1=1471274&r2=1471275&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURQueryMixTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURQueryMixTest.java Wed Apr 24 07:32:16 2013
@@ -207,7 +207,7 @@ public class SURQueryMixTest extends SUR
                 double p = (double) k / (double) n; 
                 if (d<p) {
                     // Replace a random value from the sample with the new value
-                    int keyToReplace = Math.abs(r.nextInt())%k;                    
+                    int keyToReplace = r.nextInt(k);
                     sampledKeys.set(keyToReplace, key);
                 }
             }