db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r593318 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe/direct/Standard.java
Date Thu, 08 Nov 2007 21:13:52 GMT
Author: djd
Date: Thu Nov  8 13:13:51 2007
New Revision: 593318

URL: http://svn.apache.org/viewvc?rev=593318&view=rev
Log:
Fix bug in order entry "by name" transactions, where if the last name matched to a single
row an ArrayIndexOutOfBoundsException was thrown. Code did not cater for that specific case,
rounding beyond the midpoint led to a array index of 1 for a 1 element array.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe/direct/Standard.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe/direct/Standard.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe/direct/Standard.java?rev=593318&r1=593317&r2=593318&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe/direct/Standard.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe/direct/Standard.java
Thu Nov  8 13:13:51 2007
@@ -229,8 +229,10 @@
             
             // Customer to use is midpoint (with round up) (see 2.6.2.2)
             int mid = list.size()/2;
-            if (list.size()%2 == 1)
-                mid++;
+            if (mid != 0) {
+                if (list.size()%2 == 1)
+                    mid++;
+            }
 
 
             Customer customer = (Customer) list.get(mid);
@@ -386,8 +388,10 @@
             
             // Customer to use is midpoint (with round up) (see 2.5.2.2)
             int mid = list.size()/2;
-            if (list.size()%2 == 1)
-                mid++;
+            if (mid != 0) {
+                if (list.size()%2 == 1)
+                    mid++;
+            }
             
             int c = ((Integer) list.get(mid)).intValue();
 



Mime
View raw message