Author: celestin
Date: Thu May 31 05:49:03 2012
New Revision: 1344570

URL: http://svn.apache.org/viewvc?rev=1344570&view=rev
Log:
ArrayRealVector.getEntry(int) did not throw the expected when called with an
invalid index.

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=1344570&r1=1344569&r2=1344570&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 May 31 05:49:03 2012
@@ -25,6 +25,7 @@ import org.apache.commons.math3.exceptio
 import org.apache.commons.math3.exception.DimensionMismatchException;
 import org.apache.commons.math3.exception.NumberIsTooLargeException;
 import org.apache.commons.math3.exception.MathArithmeticException;
+import org.apache.commons.math3.exception.OutOfRangeException;
 import org.apache.commons.math3.exception.util.LocalizedFormats;
 import org.apache.commons.math3.util.MathUtils;
 import org.apache.commons.math3.util.FastMath;
@@ -620,7 +621,12 @@ public class ArrayRealVector extends Rea
     /** {@inheritDoc} */
     @Override
     public double getEntry(int index) {
-        return data[index];
+        try {
+            return data[index];
+        } catch (IndexOutOfBoundsException e) {
+            throw new OutOfRangeException(LocalizedFormats.INDEX, index, 0,
+                getDimension() - 1);
+        }
     }
 
     /** {@inheritDoc} */


Reply via email to