deprecated an old style exception that was forgotten

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@981243 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Luc Maisonobe 2010-08-01 15:16:54 +00:00
parent accccd996a
commit 2431890261
7 changed files with 19 additions and 17 deletions

View File

@ -1020,7 +1020,7 @@ public abstract class AbstractFieldMatrix<T extends FieldElement<T>> implements
*/ */
protected void checkRowIndex(final int row) { protected void checkRowIndex(final int row) {
if (row < 0 || row >= getRowDimension()) { if (row < 0 || row >= getRowDimension()) {
throw new MatrixIndexException("row index {0} out of allowed range [{1}, {2}]", throw new MatrixIndexException(LocalizedFormats.ROW_INDEX_OUT_OF_RANGE,
row, 0, getRowDimension() - 1); row, 0, getRowDimension() - 1);
} }
} }
@ -1033,7 +1033,7 @@ public abstract class AbstractFieldMatrix<T extends FieldElement<T>> implements
protected void checkColumnIndex(final int column) protected void checkColumnIndex(final int column)
throws MatrixIndexException { throws MatrixIndexException {
if (column < 0 || column >= getColumnDimension()) { if (column < 0 || column >= getColumnDimension()) {
throw new MatrixIndexException("column index {0} out of allowed range [{1}, {2}]", throw new MatrixIndexException(LocalizedFormats.COLUMN_INDEX_OUT_OF_RANGE,
column, 0, getColumnDimension() - 1); column, 0, getColumnDimension() - 1);
} }
} }

View File

@ -69,9 +69,8 @@ public abstract class AbstractRealVector implements RealVector {
protected void checkIndex(final int index) protected void checkIndex(final int index)
throws MatrixIndexException { throws MatrixIndexException {
if (index < 0 || index >= getDimension()) { if (index < 0 || index >= getDimension()) {
throw new MatrixIndexException( throw new MatrixIndexException(LocalizedFormats.INDEX_OUT_OF_RANGE,
"index {0} out of allowed range [{1}, {2}]", index, 0, getDimension() - 1);
index, 0, getDimension() - 1);
} }
} }

View File

@ -794,9 +794,8 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
private void checkIndex(final int index) private void checkIndex(final int index)
throws MatrixIndexException { throws MatrixIndexException {
if (index < 0 || index >= getDimension()) { if (index < 0 || index >= getDimension()) {
throw new MatrixIndexException( throw new MatrixIndexException(LocalizedFormats.INDEX_OUT_OF_RANGE,
"index {0} out of allowed range [{1}, {2}]", index, 0, getDimension() - 1);
index, 0, getDimension() - 1);
} }
} }

View File

@ -35,7 +35,9 @@ public class MatrixIndexException extends MathRuntimeException {
* Constructs a new instance with specified formatted detail message. * Constructs a new instance with specified formatted detail message.
* @param pattern format specifier * @param pattern format specifier
* @param arguments format arguments * @param arguments format arguments
* @deprecated as of 2.2 replaced by {@link #MatrixIndexException(Localizable, Object...)}
*/ */
@Deprecated
public MatrixIndexException(final String pattern, final Object ... arguments) { public MatrixIndexException(final String pattern, final Object ... arguments) {
this(new DummyLocalizable(pattern), arguments); this(new DummyLocalizable(pattern), arguments);
} }

View File

@ -529,7 +529,7 @@ public class MatrixUtils {
*/ */
public static void checkRowIndex(final AnyMatrix m, final int row) { public static void checkRowIndex(final AnyMatrix m, final int row) {
if (row < 0 || row >= m.getRowDimension()) { if (row < 0 || row >= m.getRowDimension()) {
throw new MatrixIndexException("row index {0} out of allowed range [{1}, {2}]", throw new MatrixIndexException(LocalizedFormats.ROW_INDEX_OUT_OF_RANGE,
row, 0, m.getRowDimension() - 1); row, 0, m.getRowDimension() - 1);
} }
} }
@ -543,7 +543,7 @@ public class MatrixUtils {
public static void checkColumnIndex(final AnyMatrix m, final int column) public static void checkColumnIndex(final AnyMatrix m, final int column)
throws MatrixIndexException { throws MatrixIndexException {
if (column < 0 || column >= m.getColumnDimension()) { if (column < 0 || column >= m.getColumnDimension()) {
throw new MatrixIndexException("column index {0} out of allowed range [{1}, {2}]", throw new MatrixIndexException(LocalizedFormats.COLUMN_INDEX_OUT_OF_RANGE,
column, 0, m.getColumnDimension() - 1); column, 0, m.getColumnDimension() - 1);
} }
} }

View File

@ -549,9 +549,8 @@ public class SparseFieldVector<T extends FieldElement<T>> implements FieldVector
*/ */
private void checkIndex(final int index) throws MatrixIndexException { private void checkIndex(final int index) throws MatrixIndexException {
if (index < 0 || index >= getDimension()) { if (index < 0 || index >= getDimension()) {
throw new MatrixIndexException( throw new MatrixIndexException(LocalizedFormats.INDEX_OUT_OF_RANGE,
"index {0} out of allowed range [{1}, {2}]", index, 0, getDimension() - 1);
index, 0, getDimension() - 1);
} }
} }

View File

@ -17,6 +17,8 @@
package org.apache.commons.math.linear; package org.apache.commons.math.linear;
import org.apache.commons.math.util.LocalizedFormats;
import junit.framework.TestCase; import junit.framework.TestCase;
/** /**
@ -27,9 +29,10 @@ public class MatrixIndexExceptionTest extends TestCase {
/** /**
* *
*/ */
public void testConstructorMessage(){ public void testParameter(){
String msg = "message"; MatrixIndexException ex = new MatrixIndexException(LocalizedFormats.INDEX_OUT_OF_RANGE, 12, 0, 5);
MatrixIndexException ex = new MatrixIndexException(msg); assertEquals(12, ex.getArguments()[0]);
assertEquals(msg, ex.getMessage()); assertEquals(0, ex.getArguments()[1]);
assertEquals(5, ex.getArguments()[2]);
} }
} }