commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From celes...@apache.org
Subject svn commit: r1347717 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/ArrayRealVector.java
Date Thu, 07 Jun 2012 17:10:49 GMT
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} */



Mime
View raw message