ArrayRealVector.getEntry(int) did not throw the expected when called with an
invalid index. git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1344570 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
30c4a5bea5
commit
a25ccdc4e6
|
@ -25,6 +25,7 @@ import org.apache.commons.math3.exception.NullArgumentException;
|
|||
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 RealVector implements Serializable {
|
|||
/** {@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} */
|
||||
|
|
Loading…
Reference in New Issue