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 dj...@apache.org on 2007/11/08 22:13:52 UTC
svn commit: r593318 -
/db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe/direct/Standard.java
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();