You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ce...@apache.org on 2012/06/07 19:10:49 UTC

svn commit: r1347717 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/ArrayRealVector.java

Author: celestin
Date: Thu Jun  7 17:10:48 2012
New Revision: 1347717

URL: http://svn.apache.org/viewvc?rev=1347717&view=rev
Log:
MATH-795: RealVectorTest.testAddToEntryInvalidIndex1() and
RealVectorTest.testAddToEntryInvalidIndex2() revealed a bug in
ArrayRealVector.addToEntry(int, double) (method used to throw wrong type of
exception).

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/ArrayRealVector.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/ArrayRealVector.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/ArrayRealVector.java?rev=1347717&r1=1347716&r2=1347717&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/ArrayRealVector.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/ArrayRealVector.java Thu Jun  7 17:10:48 2012
@@ -690,7 +690,12 @@ public class ArrayRealVector extends Rea
     /** {@inheritDoc} */
     @Override
     public void addToEntry(int index, double increment) {
+        try {
         data[index] += increment;
+        } catch(IndexOutOfBoundsException e){
+            throw new OutOfRangeException(LocalizedFormats.INDEX,
+                                          index, 0, data.length - 1);
+        }
     }
 
     /** {@inheritDoc} */