commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject svn commit: r1005028 [1/2] - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/exception/ main/java/org/apache/commons/math/exception/util/ main/java/org/apache/commons/math/linear/ main/resources/META-INF/localization/ site/xdoc/ te...
Date Wed, 06 Oct 2010 13:30:04 GMT
Author: erans
Date: Wed Oct  6 13:30:03 2010
New Revision: 1005028

URL: http://svn.apache.org/viewvc?rev=1005028&view=rev
Log:
MATH-425
Replaced "MatrixIndexException" with "OutOfRangeException" or
"DimensionMismatchException".
Removed try/catch blocks misused as preconditions check.

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MultiDimensionMismatchException.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/OutOfRangeException.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/LocalizedFormats.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractFieldMatrix.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/Array2DRowFieldMatrix.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BlockFieldMatrix.java
    commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties
    commons/proper/math/trunk/src/site/xdoc/changes.xml
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/BlockFieldMatrixTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/FieldMatrixImplTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/SparseFieldMatrixTest.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MultiDimensionMismatchException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MultiDimensionMismatchException.java?rev=1005028&r1=1005027&r2=1005028&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MultiDimensionMismatchException.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MultiDimensionMismatchException.java Wed Oct  6 13:30:03 2010
@@ -37,8 +37,8 @@ public class MultiDimensionMismatchExcep
     /**
      * Construct an exception from the mismatched dimensions.
      *
-     * @param wrong Wrong dimensionq.
-     * @param expected Expected dimensionq.
+     * @param wrong Wrong dimensions.
+     * @param expected Expected dimensions.
      */
     public MultiDimensionMismatchException(Integer[] wrong,
                                            Integer[] expected) {
@@ -82,7 +82,8 @@ public class MultiDimensionMismatchExcep
         return wrong[index];
     }
     /**
-     * @return an the expected dimension stored at {@code index}..
+     * @param index Dimension index.
+     * @return the expected dimension stored at {@code index}.
      */
     public int getExpectedDimension(int index) {
         return expected[index];

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/OutOfRangeException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/OutOfRangeException.java?rev=1005028&r1=1005027&r2=1005028&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/OutOfRangeException.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/OutOfRangeException.java Wed Oct  6 13:30:03 2010
@@ -26,10 +26,8 @@ import org.apache.commons.math.exception
  * @version $Revision$ $Date$
  */
 public class OutOfRangeException extends MathIllegalNumberException {
-
     /** Serializable version Id. */
     private static final long serialVersionUID = 111601815794403609L;
-
     /** Lower bound. */
     private final Number lo;
     /** Higher bound. */

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/LocalizedFormats.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/LocalizedFormats.java?rev=1005028&r1=1005027&r2=1005028&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/LocalizedFormats.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/LocalizedFormats.java Wed Oct  6 13:30:03 2010
@@ -71,6 +71,7 @@ public enum LocalizedFormats implements 
     CLASS_DOESNT_IMPLEMENT_COMPARABLE("class ({0}) does not implement Comparable"),
     CLOSEST_ORTHOGONAL_MATRIX_HAS_NEGATIVE_DETERMINANT("the closest orthogonal matrix has a negative determinant {0}"),
     COLUMN_INDEX_OUT_OF_RANGE("column index {0} out of allowed range [{1}, {2}]"),
+    COLUMN_INDEX("column index ({0})"), /* keep */
     CONTINUED_FRACTION_INFINITY_DIVERGENCE("Continued fraction convergents diverged to +/- infinity for value {0}"),
     CONTINUED_FRACTION_NAN_DIVERGENCE("Continued fraction diverged to NaN for value {0}"),
     CONTRACTION_CRITERIA_SMALLER_THAN_EXPANSION_FACTOR("contraction criteria ({0}) smaller than the expansion factor ({1}).  This would lead to a never ending loop of expansion and contraction as a newly expanded internal storage array would immediately satisfy the criteria for contraction."),
@@ -249,6 +250,7 @@ public enum LocalizedFormats implements 
     SIGNIFICANCE_LEVEL("significance level ({0})"), /* keep */
     OUT_OF_ORDER_ABSCISSA_ARRAY("the abscissae array must be sorted in a strictly increasing order, but the {0}-th element is {1} whereas {2}-th is {3}"),
     OUT_OF_RANGE_ROOT_OF_UNITY_INDEX("out of range root of unity index {0} (must be in [{1};{2}])"),
+    OUT_OF_RANGE("out of range"), /* keep */
     OUT_OF_RANGE_SIMPLE("{0} out of [{1}, {2}] range"), /* keep */
     OVERFLOW_IN_FRACTION("overflow in fraction {0}/{1}, cannot negate"),
     OVERFLOW_IN_ADDITION("overflow in addition: {0} + {1}"),
@@ -265,6 +267,7 @@ public enum LocalizedFormats implements 
     ROOTS_OF_UNITY_NOT_COMPUTED_YET("roots of unity have not been computed yet"),
     ROTATION_MATRIX_DIMENSIONS("a {0}x{1} matrix cannot be a rotation matrix"),
     ROW_INDEX_OUT_OF_RANGE("row index {0} out of allowed range [{1}, {2}]"),
+    ROW_INDEX("row index ({0})"), /* keep */
     SAME_SIGN_AT_ENDPOINTS("function values at endpoints do not have different signs, endpoints: [{0}, {1}], values: [{2}, {3}]"),
     SAMPLE_SIZE_EXCEEDS_COLLECTION_SIZE("sample size ({0}) exceeds collection size ({1})"), /* keep */
     SAMPLE_SIZE_LARGER_THAN_POPULATION_SIZE("sample size ({0}) must be less than or equal to population size ({1})"),

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractFieldMatrix.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractFieldMatrix.java?rev=1005028&r1=1005027&r2=1005028&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractFieldMatrix.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractFieldMatrix.java Wed Oct  6 13:30:03 2010
@@ -22,8 +22,13 @@ import java.util.Arrays;
 
 import org.apache.commons.math.Field;
 import org.apache.commons.math.FieldElement;
-import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.exception.MatrixDimensionMismatchException;
+import org.apache.commons.math.exception.DimensionMismatchException;
+import org.apache.commons.math.exception.NoDataException;
+import org.apache.commons.math.exception.OutOfRangeException;
+import org.apache.commons.math.exception.NumberIsTooSmallException;
+import org.apache.commons.math.exception.NotStrictlyPositiveException;
+import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 
 /**
@@ -36,7 +41,6 @@ import org.apache.commons.math.exception
  * @since 2.0
  */
 public abstract class AbstractFieldMatrix<T extends FieldElement<T>> implements FieldMatrix<T> {
-
     /** Field to which the elements belong. */
     private final Field<T> field;
 
@@ -58,54 +62,59 @@ public abstract class AbstractFieldMatri
     /**
      * Create a new FieldMatrix<T> with the supplied row and column dimensions.
      *
-     * @param field field to which the elements belong
-     * @param rowDimension  the number of rows in the new matrix
-     * @param columnDimension  the number of columns in the new matrix
-     * @throws IllegalArgumentException if row or column dimension is not positive
+     * @param field Field to which the elements belong.
+     * @param rowDimension Number of rows in the new matrix.
+     * @param columnDimension Number of columns in the new matrix.
+     * @throws NotStrictlyPositiveException if row or column dimension is not
+     * positive.
      */
     protected AbstractFieldMatrix(final Field<T> field,
-                                  final int rowDimension, final int columnDimension)
-        throws IllegalArgumentException {
-        if (rowDimension < 1 ) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                    LocalizedFormats.INSUFFICIENT_DIMENSION, rowDimension, 1);
-        }
-        if (columnDimension < 1) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                    LocalizedFormats.INSUFFICIENT_DIMENSION, columnDimension, 1);
+                                  final int rowDimension,
+                                  final int columnDimension) {
+        if (rowDimension <= 0) {
+            throw new NotStrictlyPositiveException(LocalizedFormats.DIMENSION,
+                                                   rowDimension);
+        }
+        if (columnDimension <= 0) {
+            throw new NotStrictlyPositiveException(LocalizedFormats.DIMENSION,
+                                                   columnDimension);
         }
         this.field = field;
     }
 
     /**
      * Get the elements type from an array.
-     * @param <T> the type of the field elements
-     * @param d data array
-     * @return field to which array elements belong
-     * @exception IllegalArgumentException if array is empty
+     *
+     * @param <T> Type of the field elements.
+     * @param d Data array.
+     * @return the field to which the array elements belong.
+     * @throws NullArgumentException if the array is {@code null}.
+     * @throws NoDataException if the array is empty.
      */
-    protected static <T extends FieldElement<T>> Field<T> extractField(final T[][] d)
-        throws IllegalArgumentException {
+    protected static <T extends FieldElement<T>> Field<T> extractField(final T[][] d) {
+        if (d == null) {
+            throw new NullArgumentException();
+        }
         if (d.length == 0) {
-            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.AT_LEAST_ONE_ROW);
+            throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
         }
         if (d[0].length == 0) {
-            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
+            throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
         }
         return d[0][0].getField();
     }
 
     /**
      * Get the elements type from an array.
-     * @param <T> the type of the field elements
-     * @param d data array
-     * @return field to which array elements belong
-     * @exception IllegalArgumentException if array is empty
+     *
+     * @param <T> Type of the field elements.
+     * @param d Data array.
+     * @return the field to which the array elements belong.
+     * @throws NoDataException if array is empty.
      */
-    protected static <T extends FieldElement<T>> Field<T> extractField(final T[] d)
-        throws IllegalArgumentException {
+    protected static <T extends FieldElement<T>> Field<T> extractField(final T[] d) {
         if (d.length == 0) {
-            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.AT_LEAST_ONE_ROW);
+            throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
         }
         return d[0].getField();
     }
@@ -114,7 +123,7 @@ public abstract class AbstractFieldMatri
      * <p>
      * Complete arrays are filled with field.getZero()
      * </p>
-     * @param <T> the type of the field elements
+     * @param <T> Type of the field elements
      * @param field field to which array elements belong
      * @param rows number of rows
      * @param columns number of columns (may be negative to build partial
@@ -285,8 +294,7 @@ public abstract class AbstractFieldMatri
 
     /** {@inheritDoc} */
     public FieldMatrix<T> getSubMatrix(final int startRow, final int endRow,
-                                   final int startColumn, final int endColumn)
-        throws MatrixIndexException {
+                                       final int startColumn, final int endColumn) {
 
         checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);
 
@@ -303,8 +311,8 @@ public abstract class AbstractFieldMatri
     }
 
     /** {@inheritDoc} */
-    public FieldMatrix<T> getSubMatrix(final int[] selectedRows, final int[] selectedColumns)
-        throws MatrixIndexException {
+    public FieldMatrix<T> getSubMatrix(final int[] selectedRows,
+                                       final int[] selectedColumns) {
 
         // safety checks
         checkSubMatrixIndex(selectedRows, selectedColumns);
@@ -329,18 +337,16 @@ public abstract class AbstractFieldMatri
     /** {@inheritDoc} */
     public void copySubMatrix(final int startRow, final int endRow,
                               final int startColumn, final int endColumn,
-                              final T[][] destination)
-        throws MatrixIndexException, IllegalArgumentException {
-
+                              final T[][] destination) {
         // safety checks
         checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);
         final int rowsCount    = endRow + 1 - startRow;
         final int columnsCount = endColumn + 1 - startColumn;
         if ((destination.length < rowsCount) || (destination[0].length < columnsCount)) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
-                    destination.length, destination[0].length,
-                    rowsCount, columnsCount);
+            throw new MatrixDimensionMismatchException(destination.length,
+                                                       destination[0].length,
+                                                       rowsCount,
+                                                       columnsCount);
         }
 
         // copy entries
@@ -372,17 +378,15 @@ public abstract class AbstractFieldMatri
     }
 
     /** {@inheritDoc} */
-    public void copySubMatrix(int[] selectedRows, int[] selectedColumns, T[][] destination)
-        throws MatrixIndexException, IllegalArgumentException {
-
+    public void copySubMatrix(int[] selectedRows, int[] selectedColumns, T[][] destination) {
         // safety checks
         checkSubMatrixIndex(selectedRows, selectedColumns);
         if ((destination.length < selectedRows.length) ||
             (destination[0].length < selectedColumns.length)) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
-                    destination.length, destination[0].length,
-                    selectedRows.length, selectedColumns.length);
+            throw new MatrixDimensionMismatchException(destination.length,
+                                                       destination[0].length,
+                                                       selectedRows.length,
+                                                       selectedColumns.length);
         }
 
         // copy entries
@@ -396,24 +400,23 @@ public abstract class AbstractFieldMatri
     }
 
     /** {@inheritDoc} */
-    public void setSubMatrix(final T[][] subMatrix, final int row, final int column)
-        throws MatrixIndexException {
-
+    public void setSubMatrix(final T[][] subMatrix, final int row, final int column) {
+        if (subMatrix == null) {
+            throw new NullArgumentException();
+        }
         final int nRows = subMatrix.length;
         if (nRows == 0) {
-            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.AT_LEAST_ONE_ROW);
+            throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
         }
 
         final int nCols = subMatrix[0].length;
         if (nCols == 0) {
-            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
+            throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
         }
 
         for (int r = 1; r < nRows; ++r) {
             if (subMatrix[r].length != nCols) {
-                throw MathRuntimeException.createIllegalArgumentException(
-                        LocalizedFormats.DIFFERENT_ROWS_LENGTHS,
-                        nCols, subMatrix[r].length);
+                throw new DimensionMismatchException(nCols, subMatrix[r].length);
             }
         }
 
@@ -427,13 +430,10 @@ public abstract class AbstractFieldMatri
                 setEntry(row + i, column + j, subMatrix[i][j]);
             }
         }
-
     }
 
     /** {@inheritDoc} */
-    public FieldMatrix<T> getRowMatrix(final int row)
-        throws MatrixIndexException {
-
+    public FieldMatrix<T> getRowMatrix(final int row) {
         checkRowIndex(row);
         final int nCols = getColumnDimension();
         final FieldMatrix<T> out = createMatrix(1, nCols);
@@ -462,8 +462,7 @@ public abstract class AbstractFieldMatri
     }
 
     /** {@inheritDoc} */
-    public FieldMatrix<T> getColumnMatrix(final int column)
-        throws MatrixIndexException {
+    public FieldMatrix<T> getColumnMatrix(final int column) {
 
         checkColumnIndex(column);
         final int nRows = getRowDimension();
@@ -493,8 +492,7 @@ public abstract class AbstractFieldMatri
     }
 
     /** {@inheritDoc} */
-    public FieldVector<T> getRowVector(final int row)
-        throws MatrixIndexException {
+    public FieldVector<T> getRowVector(final int row) {
         return new ArrayFieldVector<T>(getRow(row), false);
     }
 
@@ -513,8 +511,7 @@ public abstract class AbstractFieldMatri
     }
 
     /** {@inheritDoc} */
-    public FieldVector<T> getColumnVector(final int column)
-        throws MatrixIndexException {
+    public FieldVector<T> getColumnVector(final int column) {
         return new ArrayFieldVector<T>(getColumn(column), false);
     }
 
@@ -533,9 +530,7 @@ public abstract class AbstractFieldMatri
     }
 
     /** {@inheritDoc} */
-    public T[] getRow(final int row)
-        throws MatrixIndexException {
-
+    public T[] getRow(final int row) {
         checkRowIndex(row);
         final int nCols = getColumnDimension();
         final T[] out = buildArray(field, nCols);
@@ -561,9 +556,7 @@ public abstract class AbstractFieldMatri
     }
 
     /** {@inheritDoc} */
-    public T[] getColumn(final int column)
-        throws MatrixIndexException {
-
+    public T[] getColumn(final int column) {
         checkColumnIndex(column);
         final int nRows = getRowDimension();
         final T[] out = buildArray(field, nRows);
@@ -588,20 +581,16 @@ public abstract class AbstractFieldMatri
     }
 
     /** {@inheritDoc} */
-    public abstract T getEntry(int row, int column)
-        throws MatrixIndexException;
+    public abstract T getEntry(int row, int column);
 
     /** {@inheritDoc} */
-    public abstract void setEntry(int row, int column, T value)
-        throws MatrixIndexException;
+    public abstract void setEntry(int row, int column, T value);
 
     /** {@inheritDoc} */
-    public abstract void addToEntry(int row, int column, T increment)
-        throws MatrixIndexException;
+    public abstract void addToEntry(int row, int column, T increment);
 
     /** {@inheritDoc} */
-    public abstract void multiplyEntry(int row, int column, T factor)
-        throws MatrixIndexException;
+    public abstract void multiplyEntry(int row, int column, T factor);
 
     /** {@inheritDoc} */
     public FieldMatrix<T> transpose() {
@@ -652,9 +641,7 @@ public abstract class AbstractFieldMatri
         final int nRows = getRowDimension();
         final int nCols = getColumnDimension();
         if (v.length != nCols) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                    LocalizedFormats.VECTOR_LENGTH_MISMATCH,
-                    v.length, nCols);
+            throw new DimensionMismatchException(v.length, nCols);
         }
 
         final T[] out = buildArray(field, nRows);
@@ -678,9 +665,7 @@ public abstract class AbstractFieldMatri
             final int nRows = getRowDimension();
             final int nCols = getColumnDimension();
             if (v.getDimension() != nCols) {
-                throw MathRuntimeException.createIllegalArgumentException(
-                        LocalizedFormats.VECTOR_LENGTH_MISMATCH,
-                        v.getDimension(), nCols);
+                throw new DimensionMismatchException(v.getDimension(), nCols);
             }
 
             final T[] out = buildArray(field, nRows);
@@ -703,9 +688,7 @@ public abstract class AbstractFieldMatri
         final int nRows = getRowDimension();
         final int nCols = getColumnDimension();
         if (v.length != nRows) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                    LocalizedFormats.VECTOR_LENGTH_MISMATCH,
-                    v.length, nRows);
+            throw new DimensionMismatchException(v.length, nRows);
         }
 
         final T[] out = buildArray(field, nCols);
@@ -730,9 +713,7 @@ public abstract class AbstractFieldMatri
             final int nRows = getRowDimension();
             final int nCols = getColumnDimension();
             if (v.getDimension() != nRows) {
-                throw MathRuntimeException.createIllegalArgumentException(
-                        LocalizedFormats.VECTOR_LENGTH_MISMATCH,
-                        v.getDimension(), nRows);
+                throw new DimensionMismatchException(v.getDimension(), nRows);
             }
 
             final T[] out = buildArray(field, nCols);
@@ -782,7 +763,7 @@ public abstract class AbstractFieldMatri
     public T walkInRowOrder(final FieldMatrixChangingVisitor<T> visitor,
                             final int startRow, final int endRow,
                             final int startColumn, final int endColumn)
-        throws MatrixIndexException, MatrixVisitorException {
+        throws MatrixVisitorException {
         checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);
         visitor.start(getRowDimension(), getColumnDimension(),
                       startRow, endRow, startColumn, endColumn);
@@ -800,7 +781,7 @@ public abstract class AbstractFieldMatri
     public T walkInRowOrder(final FieldMatrixPreservingVisitor<T> visitor,
                                  final int startRow, final int endRow,
                                  final int startColumn, final int endColumn)
-        throws MatrixIndexException, MatrixVisitorException {
+        throws MatrixVisitorException {
         checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);
         visitor.start(getRowDimension(), getColumnDimension(),
                       startRow, endRow, startColumn, endColumn);
@@ -846,7 +827,7 @@ public abstract class AbstractFieldMatri
     public T walkInColumnOrder(final FieldMatrixChangingVisitor<T> visitor,
                                final int startRow, final int endRow,
                                final int startColumn, final int endColumn)
-    throws MatrixIndexException, MatrixVisitorException {
+    throws MatrixVisitorException {
         checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);
         visitor.start(getRowDimension(), getColumnDimension(),
                       startRow, endRow, startColumn, endColumn);
@@ -864,7 +845,7 @@ public abstract class AbstractFieldMatri
     public T walkInColumnOrder(final FieldMatrixPreservingVisitor<T> visitor,
                                final int startRow, final int endRow,
                                final int startColumn, final int endColumn)
-    throws MatrixIndexException, MatrixVisitorException {
+    throws MatrixVisitorException {
         checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);
         visitor.start(getRowDimension(), getColumnDimension(),
                       startRow, endRow, startColumn, endColumn);
@@ -892,7 +873,7 @@ public abstract class AbstractFieldMatri
     public T walkInOptimizedOrder(final FieldMatrixChangingVisitor<T> visitor,
                                        final int startRow, final int endRow,
                                        final int startColumn, final int endColumn)
-        throws MatrixIndexException, MatrixVisitorException {
+        throws MatrixVisitorException {
         return walkInRowOrder(visitor, startRow, endRow, startColumn, endColumn);
     }
 
@@ -900,7 +881,7 @@ public abstract class AbstractFieldMatri
     public T walkInOptimizedOrder(final FieldMatrixPreservingVisitor<T> visitor,
                                        final int startRow, final int endRow,
                                        final int startColumn, final int endColumn)
-        throws MatrixIndexException, MatrixVisitorException {
+        throws MatrixVisitorException {
         return walkInRowOrder(visitor, startRow, endRow, startColumn, endColumn);
     }
 
@@ -989,26 +970,27 @@ public abstract class AbstractFieldMatri
 
     /**
      * Check if a row index is valid.
-     * @param row row index to check
-     * @exception MatrixIndexException if index is not valid
+     *
+     * @param row Row index to check.
+     * @throws OutOfRangeException if {@code index} is not valid.
      */
     protected void checkRowIndex(final int row) {
         if (row < 0 || row >= getRowDimension()) {
-            throw new MatrixIndexException(LocalizedFormats.ROW_INDEX_OUT_OF_RANGE,
-                                           row, 0, getRowDimension() - 1);
+            throw new OutOfRangeException(LocalizedFormats.ROW_INDEX,
+                                          row, 0, getRowDimension() - 1);
         }
     }
 
     /**
      * Check if a column index is valid.
-     * @param column column index to check
-     * @exception MatrixIndexException if index is not valid
+     *
+     * @param column Column index to check.
+     * @throws OutOfRangeException if {@code index} is not valid.
      */
-    protected void checkColumnIndex(final int column)
-        throws MatrixIndexException {
+    protected void checkColumnIndex(final int column) {
         if (column < 0 || column >= getColumnDimension()) {
-            throw new MatrixIndexException(LocalizedFormats.COLUMN_INDEX_OUT_OF_RANGE,
-                                           column, 0, getColumnDimension() - 1);
+            throw new OutOfRangeException(LocalizedFormats.COLUMN_INDEX,
+                                          column, 0, getColumnDimension() - 1);
         }
     }
 
@@ -1016,26 +998,28 @@ public abstract class AbstractFieldMatri
      * Check if submatrix ranges indices are valid.
      * Rows and columns are indicated counting from 0 to n-1.
      *
-     * @param startRow Initial row index
-     * @param endRow Final row index
-     * @param startColumn Initial column index
-     * @param endColumn Final column index
-     * @exception MatrixIndexException  if the indices are not valid
+     * @param startRow Initial row index.
+     * @param endRow Final row index.
+     * @param startColumn Initial column index.
+     * @param endColumn Final column index.
+     * @throws OutOfRangeException if the indices are not valid.
+     * @throws NumberIsTooSmallException if {@code endRow < startRow} or
+     * {@code endColumn < startColumn}.
      */
     protected void checkSubMatrixIndex(final int startRow, final int endRow,
                                        final int startColumn, final int endColumn) {
         checkRowIndex(startRow);
         checkRowIndex(endRow);
-        if (startRow > endRow) {
-            throw new MatrixIndexException(LocalizedFormats.INITIAL_ROW_AFTER_FINAL_ROW,
-                                           startRow, endRow);
+        if (endRow < startRow) {
+            throw new NumberIsTooSmallException(LocalizedFormats.INITIAL_ROW_AFTER_FINAL_ROW,
+                                                endRow, startRow, true);
         }
 
         checkColumnIndex(startColumn);
         checkColumnIndex(endColumn);
-        if (startColumn > endColumn) {
-            throw new MatrixIndexException(LocalizedFormats.INITIAL_COLUMN_AFTER_FINAL_COLUMN,
-                                           startColumn, endColumn);
+        if (endColumn < startColumn) {
+            throw new NumberIsTooSmallException(LocalizedFormats.INITIAL_COLUMN_AFTER_FINAL_COLUMN,
+                                                endColumn, startColumn, true);
         }
     }
 
@@ -1045,14 +1029,18 @@ public abstract class AbstractFieldMatri
      *
      * @param selectedRows Array of row indices.
      * @param selectedColumns Array of column indices.
-     * @exception MatrixIndexException if row or column selections are not valid
+     * @throws NullArgumentException if the arrays are {@code null}.
+     * @throws NoDataException if the arrays have zero length.
+     * @throws OutOfRangeException if row or column selections are not valid.
      */
     protected void checkSubMatrixIndex(final int[] selectedRows, final int[] selectedColumns) {
-        if (selectedRows.length * selectedColumns.length == 0) {
-            if (selectedRows.length == 0) {
-                throw new MatrixIndexException(LocalizedFormats.EMPTY_SELECTED_ROW_INDEX_ARRAY);
-            }
-            throw new MatrixIndexException(LocalizedFormats.EMPTY_SELECTED_COLUMN_INDEX_ARRAY);
+        if (selectedRows == null ||
+            selectedColumns == null) {
+            throw new NullArgumentException();
+        }
+        if (selectedRows.length == 0 ||
+            selectedColumns.length == 0) {
+            throw new NoDataException();
         }
 
         for (final int row : selectedRows) {
@@ -1064,46 +1052,45 @@ public abstract class AbstractFieldMatri
     }
 
     /**
-     * Check if a matrix is addition compatible with the instance
-     * @param m matrix to check
-     * @exception IllegalArgumentException if matrix is not addition compatible with instance
+     * Check if a matrix is addition compatible with the instance.
+     *
+     * @param m Matrix to check.
+     * @throws MatrixDimensionMismatchException if the matrix is not
+     * addition-compatible with instance.
      */
     protected void checkAdditionCompatible(final FieldMatrix<T> m) {
-        if ((getRowDimension()    != m.getRowDimension()) ||
+        if ((getRowDimension() != m.getRowDimension()) ||
             (getColumnDimension() != m.getColumnDimension())) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                    LocalizedFormats.NOT_ADDITION_COMPATIBLE_MATRICES,
-                    getRowDimension(), getColumnDimension(),
-                    m.getRowDimension(), m.getColumnDimension());
+            throw new MatrixDimensionMismatchException(m.getRowDimension(), m.getColumnDimension(),
+                                                       getRowDimension(), getColumnDimension());
         }
     }
 
     /**
-     * Check if a matrix is subtraction compatible with the instance
-     * @param m matrix to check
-     * @exception IllegalArgumentException if matrix is not subtraction compatible with instance
+     * Check if a matrix is subtraction compatible with the instance.
+     *
+     * @param m Matrix to check.
+     * @throws MatrixDimensionMismatchException if the matrix is not
+     * subtraction-compatible with instance.
      */
     protected void checkSubtractionCompatible(final FieldMatrix<T> m) {
-        if ((getRowDimension()    != m.getRowDimension()) ||
+        if ((getRowDimension() != m.getRowDimension()) ||
             (getColumnDimension() != m.getColumnDimension())) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                    LocalizedFormats.NOT_SUBTRACTION_COMPATIBLE_MATRICES,
-                    getRowDimension(), getColumnDimension(),
-                    m.getRowDimension(), m.getColumnDimension());
+            throw new MatrixDimensionMismatchException(m.getRowDimension(), m.getColumnDimension(),
+                                                       getRowDimension(), getColumnDimension());
         }
     }
 
     /**
-     * Check if a matrix is multiplication compatible with the instance
-     * @param m matrix to check
-     * @exception IllegalArgumentException if matrix is not multiplication compatible with instance
+     * Check if a matrix is multiplication compatible with the instance.
+     *
+     * @param m Matrix to check.
+     * @throws DimensionMismatchException if the matrix is not
+     * multiplication-compatible with instance.
      */
     protected void checkMultiplicationCompatible(final FieldMatrix<T> m) {
         if (getColumnDimension() != m.getRowDimension()) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                    LocalizedFormats.NOT_MULTIPLICATION_COMPATIBLE_MATRICES,
-                    getRowDimension(), getColumnDimension(),
-                    m.getRowDimension(), m.getColumnDimension());
+            throw new DimensionMismatchException(m.getRowDimension(), getColumnDimension());
         }
     }
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/Array2DRowFieldMatrix.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/Array2DRowFieldMatrix.java?rev=1005028&r1=1005027&r2=1005028&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/Array2DRowFieldMatrix.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/Array2DRowFieldMatrix.java Wed Oct  6 13:30:03 2010
@@ -303,8 +303,7 @@ public class Array2DRowFieldMatrix<T ext
 
     /** {@inheritDoc} */
     @Override
-    public void setSubMatrix(final T[][] subMatrix, final int row, final int column)
-    throws MatrixIndexException {
+    public void setSubMatrix(final T[][] subMatrix, final int row, final int column) {
         if (data == null) {
             if (row > 0) {
                 throw MathRuntimeException.createIllegalStateException(
@@ -341,50 +340,38 @@ public class Array2DRowFieldMatrix<T ext
 
     /** {@inheritDoc} */
     @Override
-    public T getEntry(final int row, final int column)
-        throws MatrixIndexException {
-        try {
-            return data[row][column];
-        } catch (ArrayIndexOutOfBoundsException e) {
-            throw new MatrixIndexException(
-                      LocalizedFormats.NO_SUCH_MATRIX_ENTRY, row, column, getRowDimension(), getColumnDimension());
-        }
+    public T getEntry(final int row, final int column) {
+        checkRowIndex(row);
+        checkColumnIndex(column);
+
+        return data[row][column];
     }
 
     /** {@inheritDoc} */
     @Override
-    public void setEntry(final int row, final int column, final T value)
-        throws MatrixIndexException {
-        try {
-            data[row][column] = value;
-        } catch (ArrayIndexOutOfBoundsException e) {
-            throw new MatrixIndexException(
-                      LocalizedFormats.NO_SUCH_MATRIX_ENTRY, row, column, getRowDimension(), getColumnDimension());
-        }
+    public void setEntry(final int row, final int column, final T value) {
+        checkRowIndex(row);
+        checkColumnIndex(column);
+
+        data[row][column] = value;
     }
 
     /** {@inheritDoc} */
     @Override
-    public void addToEntry(final int row, final int column, final T increment)
-        throws MatrixIndexException {
-        try {
-            data[row][column] = data[row][column].add(increment);
-        } catch (ArrayIndexOutOfBoundsException e) {
-            throw new MatrixIndexException(
-                      LocalizedFormats.NO_SUCH_MATRIX_ENTRY, row, column, getRowDimension(), getColumnDimension());
-        }
+    public void addToEntry(final int row, final int column, final T increment) {
+        checkRowIndex(row);
+        checkColumnIndex(column);
+
+        data[row][column] = data[row][column].add(increment);
     }
 
     /** {@inheritDoc} */
     @Override
-    public void multiplyEntry(final int row, final int column, final T factor)
-        throws MatrixIndexException {
-        try {
-            data[row][column] = data[row][column].multiply(factor);
-        } catch (ArrayIndexOutOfBoundsException e) {
-            throw new MatrixIndexException(
-                      LocalizedFormats.NO_SUCH_MATRIX_ENTRY, row, column, getRowDimension(), getColumnDimension());
-        }
+    public void multiplyEntry(final int row, final int column, final T factor) {
+        checkRowIndex(row);
+        checkColumnIndex(column);
+
+        data[row][column] = data[row][column].multiply(factor);
     }
 
     /** {@inheritDoc} */
@@ -483,7 +470,7 @@ public class Array2DRowFieldMatrix<T ext
     public T walkInRowOrder(final FieldMatrixChangingVisitor<T> visitor,
                             final int startRow, final int endRow,
                             final int startColumn, final int endColumn)
-        throws MatrixIndexException, MatrixVisitorException {
+        throws MatrixVisitorException {
         checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);
         visitor.start(getRowDimension(), getColumnDimension(),
                       startRow, endRow, startColumn, endColumn);
@@ -501,7 +488,7 @@ public class Array2DRowFieldMatrix<T ext
     public T walkInRowOrder(final FieldMatrixPreservingVisitor<T> visitor,
                             final int startRow, final int endRow,
                             final int startColumn, final int endColumn)
-        throws MatrixIndexException, MatrixVisitorException {
+        throws MatrixVisitorException {
         checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);
         visitor.start(getRowDimension(), getColumnDimension(),
                       startRow, endRow, startColumn, endColumn);
@@ -550,7 +537,7 @@ public class Array2DRowFieldMatrix<T ext
     public T walkInColumnOrder(final FieldMatrixChangingVisitor<T> visitor,
                                final int startRow, final int endRow,
                                final int startColumn, final int endColumn)
-        throws MatrixIndexException, MatrixVisitorException {
+        throws MatrixVisitorException {
         checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);
         visitor.start(getRowDimension(), getColumnDimension(),
                       startRow, endRow, startColumn, endColumn);
@@ -568,7 +555,7 @@ public class Array2DRowFieldMatrix<T ext
     public T walkInColumnOrder(final FieldMatrixPreservingVisitor<T> visitor,
                                final int startRow, final int endRow,
                                final int startColumn, final int endColumn)
-        throws MatrixIndexException, MatrixVisitorException {
+        throws MatrixVisitorException {
         checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);
         visitor.start(getRowDimension(), getColumnDimension(),
                       startRow, endRow, startColumn, endColumn);

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BlockFieldMatrix.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BlockFieldMatrix.java?rev=1005028&r1=1005027&r2=1005028&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BlockFieldMatrix.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BlockFieldMatrix.java Wed Oct  6 13:30:03 2010
@@ -68,40 +68,31 @@ import org.apache.commons.math.util.Fast
  * @since 2.0
  */
 public class BlockFieldMatrix<T extends FieldElement<T>> extends AbstractFieldMatrix<T> implements Serializable {
-
     /** Block size. */
     public static final int BLOCK_SIZE = 36;
-
-    /** Serializable version identifier */
+    /** Serializable version identifier. */
     private static final long serialVersionUID = -4602336630143123183L;
-
     /** Blocks of matrix entries. */
     private final T blocks[][];
-
     /** Number of rows of the matrix. */
     private final int rows;
-
     /** Number of columns of the matrix. */
     private final int columns;
-
     /** Number of block rows of the matrix. */
     private final int blockRows;
-
     /** Number of block columns of the matrix. */
     private final int blockColumns;
 
     /**
      * Create a new matrix with the supplied row and column dimensions.
      *
-     * @param field field to which the elements belong
-     * @param rows  the number of rows in the new matrix
-     * @param columns  the number of columns in the new matrix
-     * @throws IllegalArgumentException if row or column dimension is not
-     *  positive
+     * @param field Field to which the elements belong.
+     * @param rows Number of rows in the new matrix.
+     * @param columns Number of columns in the new matrix.
+     * @throws org.apache.commons.math.exception.NotStrictlyPositiveException
+     * if row or column dimension is not positive.
      */
-    public BlockFieldMatrix(final Field<T> field, final int rows, final int columns)
-        throws IllegalArgumentException {
-
+    public BlockFieldMatrix(final Field<T> field, final int rows, final int columns) {
         super(field, rows, columns);
         this.rows    = rows;
         this.columns = columns;
@@ -112,7 +103,6 @@ public class BlockFieldMatrix<T extends 
 
         // allocate storage blocks, taking care of smaller ones at right and bottom
         blocks = createBlocksLayout(field, rows, columns);
-
     }
 
     /**
@@ -122,14 +112,13 @@ public class BlockFieldMatrix<T extends 
      * <pre>matrix = new BlockFieldMatrix<T>(getField(), rawData.length, rawData[0].length,
      *                                   toBlocksLayout(rawData), false);</pre>
      * </p>
-     * @param rawData data for new matrix, in raw layout
+     * @param rawData Data for the new matrix, in raw layout.
      *
-     * @exception IllegalArgumentException if <code>blockData</code> shape is
-     * inconsistent with block layout
+     * @exception DimensionMismatchException if the {@code blockData} shape is
+     * inconsistent with block layout.
      * @see #BlockFieldMatrix(int, int, FieldElement[][], boolean)
      */
-    public BlockFieldMatrix(final T[][] rawData)
-        throws IllegalArgumentException {
+    public BlockFieldMatrix(final T[][] rawData) {
         this(rawData.length, rawData[0].length, toBlocksLayout(rawData), false);
     }
 
@@ -142,16 +131,14 @@ public class BlockFieldMatrix<T extends 
      * @param copyArray if true, the input array will be copied, otherwise
      * it will be referenced
      *
-     * @exception IllegalArgumentException if <code>blockData</code> shape is
-     * inconsistent with block layout
+     * @exception DimensionMismatchException if the {@code blockData} shape is
+     * inconsistent with block layout.
      * @see #createBlocksLayout(Field, int, int)
      * @see #toBlocksLayout(FieldElement[][])
      * @see #BlockFieldMatrix(FieldElement[][])
      */
     public BlockFieldMatrix(final int rows, final int columns,
-                            final T[][] blockData, final boolean copyArray)
-        throws IllegalArgumentException {
-
+                            final T[][] blockData, final boolean copyArray) {
         super(extractField(blockData), rows, columns);
         this.rows    = rows;
         this.columns = columns;
@@ -181,7 +168,6 @@ public class BlockFieldMatrix<T extends 
                 }
             }
         }
-
     }
 
     /**
@@ -200,16 +186,15 @@ public class BlockFieldMatrix<T extends 
      * #BlockFieldMatrix(int, int, FieldElement[][], boolean)}
      * constructor.
      * </p>
-     * @param <T> the type of the field elements
-     * @param rawData data array in raw layout
+     * @param <T> Type of the field elements.
+     * @param rawData Data array in raw layout.
      * @return a new data array containing the same entries but in blocks layout
-     * @exception IllegalArgumentException if <code>rawData</code> is not rectangular
-     *  (not all rows have the same length)
+     * @throws DimensionMismatchException if {@code rawData} is not rectangular
+     *  (not all rows have the same length).
      * @see #createBlocksLayout(Field, int, int)
      * @see #BlockFieldMatrix(int, int, FieldElement[][], boolean)
      */
-    public static <T extends FieldElement<T>> T[][] toBlocksLayout(final T[][] rawData)
-        throws IllegalArgumentException {
+    public static <T extends FieldElement<T>> T[][] toBlocksLayout(final T[][] rawData) {
 
         final int rows         = rawData.length;
         final int columns      = rawData[0].length;
@@ -249,12 +234,10 @@ public class BlockFieldMatrix<T extends 
                 }
 
                 ++blockIndex;
-
             }
         }
 
         return blocks;
-
     }
 
     /**
@@ -264,17 +247,16 @@ public class BlockFieldMatrix<T extends 
      * #BlockFieldMatrix(int, int, FieldElement[][], boolean)}
      * constructor.
      * </p>
-     * @param <T> the type of the field elements
-     * @param field field to which the elements belong
-     * @param rows  the number of rows in the new matrix
-     * @param columns  the number of columns in the new matrix
-     * @return a new data array in blocks layout
+     * @param <T> Type of the field elements.
+     * @param field Field to which the elements belong.
+     * @param rows Number of rows in the new matrix.
+     * @param columns Number of columns in the new matrix.
+     * @return a new data array in blocks layout.
      * @see #toBlocksLayout(FieldElement[][])
      * @see #BlockFieldMatrix(int, int, FieldElement[][], boolean)
      */
     public static <T extends FieldElement<T>> T[][] createBlocksLayout(final Field<T> field,
                                                                        final int rows, final int columns) {
-
         final int blockRows    = (rows    + BLOCK_SIZE - 1) / BLOCK_SIZE;
         final int blockColumns = (columns + BLOCK_SIZE - 1) / BLOCK_SIZE;
 
@@ -294,13 +276,11 @@ public class BlockFieldMatrix<T extends 
         }
 
         return blocks;
-
     }
 
     /** {@inheritDoc} */
     @Override
-    public FieldMatrix<T> createMatrix(final int rowDimension, final int columnDimension)
-        throws IllegalArgumentException {
+    public FieldMatrix<T> createMatrix(final int rowDimension, final int columnDimension) {
         return new BlockFieldMatrix<T>(getField(), rowDimension, columnDimension);
     }
 
@@ -317,13 +297,11 @@ public class BlockFieldMatrix<T extends 
         }
 
         return copied;
-
     }
 
     /** {@inheritDoc} */
     @Override
-    public FieldMatrix<T> add(final FieldMatrix<T> m)
-        throws IllegalArgumentException {
+    public FieldMatrix<T> add(final FieldMatrix<T> m) {
         try {
             return add((BlockFieldMatrix<T>) m);
         } catch (ClassCastException cce) {
@@ -360,7 +338,6 @@ public class BlockFieldMatrix<T extends 
             }
 
             return out;
-
         }
     }
 
@@ -371,8 +348,7 @@ public class BlockFieldMatrix<T extends 
      * @return     this + m
      * @throws  IllegalArgumentException if m is not the same size as this
      */
-    public BlockFieldMatrix<T> add(final BlockFieldMatrix<T> m)
-        throws IllegalArgumentException {
+    public BlockFieldMatrix<T> add(final BlockFieldMatrix<T> m) {
 
         // safety check
         checkAdditionCompatible(m);
@@ -390,7 +366,6 @@ public class BlockFieldMatrix<T extends 
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
@@ -433,7 +408,6 @@ public class BlockFieldMatrix<T extends 
             }
 
             return out;
-
         }
     }
 
@@ -444,9 +418,7 @@ public class BlockFieldMatrix<T extends 
      * @return     this - m
      * @throws  IllegalArgumentException if m is not the same size as this
      */
-    public BlockFieldMatrix<T> subtract(final BlockFieldMatrix<T> m)
-        throws IllegalArgumentException {
-
+    public BlockFieldMatrix<T> subtract(final BlockFieldMatrix<T> m) {
         // safety check
         checkSubtractionCompatible(m);
 
@@ -463,14 +435,11 @@ public class BlockFieldMatrix<T extends 
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
     @Override
-    public FieldMatrix<T> scalarAdd(final T d)
-        throws IllegalArgumentException {
-
+    public FieldMatrix<T> scalarAdd(final T d) {
         final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), rows, columns);
 
         // perform subtraction block-wise, to ensure good cache behavior
@@ -483,13 +452,11 @@ public class BlockFieldMatrix<T extends 
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
     @Override
-    public FieldMatrix<T> scalarMultiply(final T d)
-        throws IllegalArgumentException {
+    public FieldMatrix<T> scalarMultiply(final T d) {
 
         final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), rows, columns);
 
@@ -503,13 +470,11 @@ public class BlockFieldMatrix<T extends 
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
     @Override
-    public FieldMatrix<T> multiply(final FieldMatrix<T> m)
-        throws IllegalArgumentException {
+    public FieldMatrix<T> multiply(final FieldMatrix<T> m) {
         try {
             return multiply((BlockFieldMatrix<T>) m);
         } catch (ClassCastException cce) {
@@ -564,7 +529,6 @@ public class BlockFieldMatrix<T extends 
             }
 
             return out;
-
         }
     }
 
@@ -576,7 +540,7 @@ public class BlockFieldMatrix<T extends 
      * @throws     IllegalArgumentException
      *             if columnDimension(this) != rowDimension(m)
      */
-    public BlockFieldMatrix<T> multiply(BlockFieldMatrix<T> m) throws IllegalArgumentException {
+    public BlockFieldMatrix<T> multiply(BlockFieldMatrix<T> m) {
 
         // safety check
         checkMultiplicationCompatible(m);
@@ -634,12 +598,10 @@ public class BlockFieldMatrix<T extends 
 
                 // go to next block
                 ++blockIndex;
-
             }
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
@@ -669,15 +631,12 @@ public class BlockFieldMatrix<T extends 
         }
 
         return data;
-
     }
 
     /** {@inheritDoc} */
     @Override
     public FieldMatrix<T> getSubMatrix(final int startRow, final int endRow,
-                                   final int startColumn, final int endColumn)
-        throws MatrixIndexException {
-
+                                       final int startColumn, final int endColumn) {
         // safety checks
         checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);
 
@@ -760,16 +719,12 @@ public class BlockFieldMatrix<T extends 
                                       outBlock, jWidth, 0, 0);
                     }
                }
-
                 ++qBlock;
             }
-
             ++pBlock;
-
         }
 
         return out;
-
     }
 
     /**
@@ -804,9 +759,7 @@ public class BlockFieldMatrix<T extends 
 
     /** {@inheritDoc} */
     @Override
-    public void setSubMatrix(final T[][] subMatrix, final int row, final int column)
-        throws MatrixIndexException {
-
+    public void setSubMatrix(final T[][] subMatrix, final int row, final int column) {
         // safety checks
         final int refLength = subMatrix[0].length;
         if (refLength == 0) {
@@ -855,9 +808,7 @@ public class BlockFieldMatrix<T extends 
 
     /** {@inheritDoc} */
     @Override
-    public FieldMatrix<T> getRowMatrix(final int row)
-        throws MatrixIndexException {
-
+    public FieldMatrix<T> getRowMatrix(final int row) {
         checkRowIndex(row);
         final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), 1, columns);
 
@@ -883,7 +834,6 @@ public class BlockFieldMatrix<T extends 
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
@@ -903,9 +853,10 @@ public class BlockFieldMatrix<T extends 
      * @param row the row to be set
      * @param matrix row matrix (must have one row and the same number of columns
      * as the instance)
-     * @throws MatrixIndexException if the specified row index is invalid
-     * @throws MatrixDimensionMismatchException if the matrix dimensions do not match one
-     * instance row
+     * @throws org.apache.commons.math.exception.OutOfRangeException if the
+     * specified row index is invalid.
+     * @throws MatrixDimensionMismatchException if the matrix dimensions do
+     * not match one instance row.
      */
     public void setRowMatrix(final int row, final BlockFieldMatrix<T> matrix) {
         checkRowIndex(row);
@@ -937,14 +888,11 @@ public class BlockFieldMatrix<T extends 
                 mIndex += jWidth;
            }
         }
-
     }
 
     /** {@inheritDoc} */
     @Override
-    public FieldMatrix<T> getColumnMatrix(final int column)
-        throws MatrixIndexException {
-
+    public FieldMatrix<T> getColumnMatrix(final int column) {
         checkColumnIndex(column);
         final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), rows, 1);
 
@@ -968,7 +916,6 @@ public class BlockFieldMatrix<T extends 
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
@@ -982,15 +929,16 @@ public class BlockFieldMatrix<T extends 
     }
 
     /**
-     * Sets the entries in column number <code>column</code>
+     * Sets the entries in column number {@code column}
      * as a column matrix.  Column indices start at 0.
      *
-     * @param column the column to be set
-     * @param matrix column matrix (must have one column and the same number of rows
-     * as the instance)
-     * @throws MatrixIndexException if the specified column index is invalid
-     * @throws MatrixDimensionMismatchException if the matrix dimensions do not match one
-     * instance column
+     * @param column Column to be set.
+     * @param matrix Column matrix (must have one column and the same number of rows
+     * as the instance).
+     * @throws org.apache.commons.math.exception.OutOfRangeException if
+     * the specified column index is invalid.
+     * @throws MatrixDimensionMismatchException if the matrix dimensions do
+     * not match one instance column.
      */
     void setColumnMatrix(final int column, final BlockFieldMatrix<T> matrix) {
         checkColumnIndex(column);
@@ -1024,9 +972,7 @@ public class BlockFieldMatrix<T extends 
 
     /** {@inheritDoc} */
     @Override
-    public FieldVector<T> getRowVector(final int row)
-        throws MatrixIndexException {
-
+    public FieldVector<T> getRowVector(final int row) {
         checkRowIndex(row);
         final T[] outData = buildArray(getField(), columns);
 
@@ -1042,7 +988,6 @@ public class BlockFieldMatrix<T extends 
         }
 
         return new ArrayFieldVector<T>(outData, false);
-
     }
 
     /** {@inheritDoc} */
@@ -1057,9 +1002,7 @@ public class BlockFieldMatrix<T extends 
 
     /** {@inheritDoc} */
     @Override
-    public FieldVector<T> getColumnVector(final int column)
-        throws MatrixIndexException {
-
+    public FieldVector<T> getColumnVector(final int column) {
         checkColumnIndex(column);
         final T[] outData = buildArray(getField(), rows);
 
@@ -1077,7 +1020,6 @@ public class BlockFieldMatrix<T extends 
         }
 
         return new ArrayFieldVector<T>(outData, false);
-
     }
 
     /** {@inheritDoc} */
@@ -1092,9 +1034,7 @@ public class BlockFieldMatrix<T extends 
 
     /** {@inheritDoc} */
     @Override
-    public T[] getRow(final int row)
-        throws MatrixIndexException {
-
+    public T[] getRow(final int row) {
         checkRowIndex(row);
         final T[] out = buildArray(getField(), columns);
 
@@ -1110,7 +1050,6 @@ public class BlockFieldMatrix<T extends 
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
@@ -1136,9 +1075,7 @@ public class BlockFieldMatrix<T extends 
 
     /** {@inheritDoc} */
     @Override
-    public T[] getColumn(final int column)
-        throws MatrixIndexException {
-
+    public T[] getColumn(final int column) {
         checkColumnIndex(column);
         final T[] out = buildArray(getField(), rows);
 
@@ -1183,78 +1120,65 @@ public class BlockFieldMatrix<T extends 
 
     /** {@inheritDoc} */
     @Override
-    public T getEntry(final int row, final int column)
-        throws MatrixIndexException {
-        try {
-            final int iBlock = row    / BLOCK_SIZE;
-            final int jBlock = column / BLOCK_SIZE;
-            final int k      = (row    - iBlock * BLOCK_SIZE) * blockWidth(jBlock) +
-                               (column - jBlock * BLOCK_SIZE);
-            return blocks[iBlock * blockColumns + jBlock][k];
-        } catch (ArrayIndexOutOfBoundsException e) {
-            throw new MatrixIndexException(
-                    LocalizedFormats.NO_SUCH_MATRIX_ENTRY,
-                    row, column, getRowDimension(), getColumnDimension());
-        }
+    public T getEntry(final int row, final int column) {
+        checkRowIndex(row);
+        checkColumnIndex(column);
+
+        final int iBlock = row    / BLOCK_SIZE;
+        final int jBlock = column / BLOCK_SIZE;
+        final int k      = (row    - iBlock * BLOCK_SIZE) * blockWidth(jBlock) +
+            (column - jBlock * BLOCK_SIZE);
+
+        return blocks[iBlock * blockColumns + jBlock][k];
     }
 
     /** {@inheritDoc} */
     @Override
-    public void setEntry(final int row, final int column, final T value)
-        throws MatrixIndexException {
-        try {
-            final int iBlock = row    / BLOCK_SIZE;
-            final int jBlock = column / BLOCK_SIZE;
-            final int k      = (row    - iBlock * BLOCK_SIZE) * blockWidth(jBlock) +
-                               (column - jBlock * BLOCK_SIZE);
-            blocks[iBlock * blockColumns + jBlock][k] = value;
-        } catch (ArrayIndexOutOfBoundsException e) {
-            throw new MatrixIndexException(
-                    LocalizedFormats.NO_SUCH_MATRIX_ENTRY,
-                    row, column, getRowDimension(), getColumnDimension());
-        }
+    public void setEntry(final int row, final int column, final T value) {
+        checkRowIndex(row);
+        checkColumnIndex(column);
+
+        final int iBlock = row    / BLOCK_SIZE;
+        final int jBlock = column / BLOCK_SIZE;
+        final int k      = (row    - iBlock * BLOCK_SIZE) * blockWidth(jBlock) +
+            (column - jBlock * BLOCK_SIZE);
+
+        blocks[iBlock * blockColumns + jBlock][k] = value;
     }
 
     /** {@inheritDoc} */
     @Override
-    public void addToEntry(final int row, final int column, final T increment)
-        throws MatrixIndexException {
-        try {
-            final int iBlock = row    / BLOCK_SIZE;
-            final int jBlock = column / BLOCK_SIZE;
-            final int k      = (row    - iBlock * BLOCK_SIZE) * blockWidth(jBlock) +
-                               (column - jBlock * BLOCK_SIZE);
-            final T[] blockIJ = blocks[iBlock * blockColumns + jBlock];
-            blockIJ[k] = blockIJ[k].add(increment);
-        } catch (ArrayIndexOutOfBoundsException e) {
-            throw new MatrixIndexException(
-                    LocalizedFormats.NO_SUCH_MATRIX_ENTRY,
-                    row, column, getRowDimension(), getColumnDimension());
-        }
+    public void addToEntry(final int row, final int column, final T increment) {
+        checkRowIndex(row);
+        checkColumnIndex(column);
+
+        final int iBlock = row    / BLOCK_SIZE;
+        final int jBlock = column / BLOCK_SIZE;
+        final int k      = (row    - iBlock * BLOCK_SIZE) * blockWidth(jBlock) +
+            (column - jBlock * BLOCK_SIZE);
+        final T[] blockIJ = blocks[iBlock * blockColumns + jBlock];
+
+        blockIJ[k] = blockIJ[k].add(increment);
     }
 
     /** {@inheritDoc} */
     @Override
-    public void multiplyEntry(final int row, final int column, final T factor)
-        throws MatrixIndexException {
-        try {
-            final int iBlock = row    / BLOCK_SIZE;
-            final int jBlock = column / BLOCK_SIZE;
-            final int k      = (row    - iBlock * BLOCK_SIZE) * blockWidth(jBlock) +
-                               (column - jBlock * BLOCK_SIZE);
-            final T[] blockIJ = blocks[iBlock * blockColumns + jBlock];
-            blockIJ[k] = blockIJ[k].multiply(factor);
-        } catch (ArrayIndexOutOfBoundsException e) {
-            throw new MatrixIndexException(
-                    LocalizedFormats.NO_SUCH_MATRIX_ENTRY,
-                    row, column, getRowDimension(), getColumnDimension());
-        }
+    public void multiplyEntry(final int row, final int column, final T factor) {
+        checkRowIndex(row);
+        checkColumnIndex(column);
+
+        final int iBlock = row    / BLOCK_SIZE;
+        final int jBlock = column / BLOCK_SIZE;
+        final int k      = (row    - iBlock * BLOCK_SIZE) * blockWidth(jBlock) +
+            (column - jBlock * BLOCK_SIZE);
+        final T[] blockIJ = blocks[iBlock * blockColumns + jBlock];
+
+        blockIJ[k] = blockIJ[k].multiply(factor);
     }
 
     /** {@inheritDoc} */
     @Override
     public FieldMatrix<T> transpose() {
-
         final int nRows = getRowDimension();
         final int nCols = getColumnDimension();
         final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), nCols, nRows);
@@ -1449,7 +1373,7 @@ public class BlockFieldMatrix<T extends 
     public T walkInRowOrder(final FieldMatrixChangingVisitor<T> visitor,
                                  final int startRow, final int endRow,
                                  final int startColumn, final int endColumn)
-        throws MatrixIndexException, MatrixVisitorException {
+        throws MatrixVisitorException {
         checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);
         visitor.start(rows, columns, startRow, endRow, startColumn, endColumn);
         for (int iBlock = startRow / BLOCK_SIZE; iBlock < 1 + endRow / BLOCK_SIZE; ++iBlock) {
@@ -1479,7 +1403,7 @@ public class BlockFieldMatrix<T extends 
     public T walkInRowOrder(final FieldMatrixPreservingVisitor<T> visitor,
                                  final int startRow, final int endRow,
                                  final int startColumn, final int endColumn)
-        throws MatrixIndexException, MatrixVisitorException {
+        throws MatrixVisitorException {
         checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);
         visitor.start(rows, columns, startRow, endRow, startColumn, endColumn);
         for (int iBlock = startRow / BLOCK_SIZE; iBlock < 1 + endRow / BLOCK_SIZE; ++iBlock) {
@@ -1561,7 +1485,7 @@ public class BlockFieldMatrix<T extends 
     public T walkInOptimizedOrder(final FieldMatrixChangingVisitor<T> visitor,
                                        final int startRow, final int endRow,
                                        final int startColumn, final int endColumn)
-        throws MatrixIndexException, MatrixVisitorException {
+        throws MatrixVisitorException {
         checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);
         visitor.start(rows, columns, startRow, endRow, startColumn, endColumn);
         for (int iBlock = startRow / BLOCK_SIZE; iBlock < 1 + endRow / BLOCK_SIZE; ++iBlock) {
@@ -1591,7 +1515,7 @@ public class BlockFieldMatrix<T extends 
     public T walkInOptimizedOrder(final FieldMatrixPreservingVisitor<T> visitor,
                                        final int startRow, final int endRow,
                                        final int startColumn, final int endColumn)
-        throws MatrixIndexException, MatrixVisitorException {
+        throws MatrixVisitorException {
         checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);
         visitor.start(rows, columns, startRow, endRow, startColumn, endColumn);
         for (int iBlock = startRow / BLOCK_SIZE; iBlock < 1 + endRow / BLOCK_SIZE; ++iBlock) {

Modified: commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties?rev=1005028&r1=1005027&r2=1005028&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties (original)
+++ commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties Wed Oct  6 13:30:03 2010
@@ -43,6 +43,7 @@ CARDAN_ANGLES_SINGULARITY = singularit\u
 CLASS_DOESNT_IMPLEMENT_COMPARABLE = la classe ({0}) n''implante pas l''interface Comparable
 CLOSEST_ORTHOGONAL_MATRIX_HAS_NEGATIVE_DETERMINANT = la matrice orthogonale la plus proche a un d\u00e9terminant n\u00e9gatif {0}
 COLUMN_INDEX_OUT_OF_RANGE = l''index de colonne {0} est hors du domaine autoris\u00e9 [{1}, {2}]
+COLUMN_INDEX = index de colonne ({0})
 CONTINUED_FRACTION_INFINITY_DIVERGENCE = Divergence de fraction continue \u00e0 l''infini pour la valeur {0}
 CONTINUED_FRACTION_NAN_DIVERGENCE = Divergence de fraction continue \u00e0 NaN pour la valeur {0}
 CONTRACTION_CRITERIA_SMALLER_THAN_EXPANSION_FACTOR = crit\u00e8re de contraction ({0}) inf\u00e9rieur au facteur d''extension ({1}). Ceci induit une boucle infinie d''extensions/contractions car tout tableau de stockage fra\u00eechement \u00e9tendu respecte imm\u00e9diatement le crit\u00e8re de contraction.
@@ -100,7 +101,7 @@ INVALID_BRACKETING_PARAMETERS = param\u0
 INVALID_INTERVAL_INITIAL_VALUE_PARAMETERS = param\u00e8tres de l''intervalle initial invalides : borne inf = {0}, valeur initiale = {1}, borne sup = {2}
 INVALID_ITERATIONS_LIMITS = limites d''it\u00e9rations invalides : min = {0}, max = {1}
 INVALID_MAX_ITERATIONS = valeur invalide pour le nombre maximal d''it\u00e9rations : {0}
-INVALID_REGRESSION_ARRAY= longueur du tableau de donn\u00e9es = {0} ne correspond pas au nombre d'observations = {1} et le nombre de variables explicatives = {2}
+INVALID_REGRESSION_ARRAY= longueur du tableau de donn\u00e9es = {0} ne correspond pas au nombre d''observations = {1} et le nombre de variables explicatives = {2}
 INVALID_ROUNDING_METHOD = m\u00e9thode d''arondi {0} invalide, m\u00e9thodes valides : {1} ({2}), {3} ({4}), {5} ({6}), {7} ({8}), {9} ({10}), {11} ({12}), {13} ({14}), {15} ({16})
 ITERATOR_EXHAUSTED = it\u00e9ration achev\u00e9e
 LCM_OVERFLOW_32_BITS = d\u00e9passement de capacit\u00e9 : le MCM de {0} et {1} vaut 2^31
@@ -222,6 +223,7 @@ SIGNIFICANCE_LEVEL = niveau de significa
 OUT_OF_ORDER_ABSCISSA_ARRAY = les abscisses doivent \u00eatre en ordre strictement croissant, mais l''\u00e9l\u00e9ment {0} vaut {1} alors que l''\u00e9l\u00e9ment {2} vaut {3}
 OUT_OF_RANGE_ROOT_OF_UNITY_INDEX = l''indice de racine de l''unit\u00e9 {0} est hors du domaine autoris\u00e9 [{1};{2}]
 OUT_OF_RANGE_SIMPLE = {0} hors du domaine [{1}, {2}]
+OUT_OF_RANGE = hors domaine
 OVERFLOW_IN_FRACTION = d\u00e9passement de capacit\u00e9 pour la fraction {0}/{1}, son signe ne peut \u00eatre chang\u00e9
 OVERFLOW_IN_ADDITION = d\u00e9passement de capacit\u00e9 pour l''addition : {0} + {1}
 OVERFLOW_IN_SUBTRACTION = d\u00e9passement de capacit\u00e9 pour la soustraction : {0} - {1}
@@ -237,6 +239,7 @@ RANDOMKEY_MUTATION_WRONG_CLASS = RandomK
 ROOTS_OF_UNITY_NOT_COMPUTED_YET = les racines de l''unit\u00e9 n''ont pas encore \u00e9t\u00e9 calcul\u00e9es
 ROTATION_MATRIX_DIMENSIONS = une matrice {0}x{1} ne peut pas \u00eatre une matrice de rotation
 ROW_INDEX_OUT_OF_RANGE = l''index de ligne {0} est hors du domaine autoris\u00e9 [{1}, {2}]
+ROW_INDEX = index de ligne ({0})
 SAME_SIGN_AT_ENDPOINTS = les valeurs aux bornes de la fonction devraient avoir des signes difff\u00e9rents ; bornes : [{0}, {1}], valeurs : [{2}, {3}]
 SAMPLE_SIZE_EXCEEDS_COLLECTION_SIZE = la taille de l''\u00e9chantillon ({0}) d\u00e9passe la taille de la collection ({1})
 SAMPLE_SIZE_LARGER_THAN_POPULATION_SIZE = la taille de l''\u00e9chantillon doit \u00eatre inf\u00e9rieure 

Modified: commons/proper/math/trunk/src/site/xdoc/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/site/xdoc/changes.xml?rev=1005028&r1=1005027&r2=1005028&view=diff
==============================================================================
--- commons/proper/math/trunk/src/site/xdoc/changes.xml (original)
+++ commons/proper/math/trunk/src/site/xdoc/changes.xml Wed Oct  6 13:30:03 2010
@@ -52,6 +52,9 @@ The <action> type attribute can be add,u
     If the output is not quite correct, check for invisible trailing spaces!
      -->
     <release version="3.0" date="TBD" description="TBD">
+      <action dev="erans" type="update" issue="MATH-425">
+        Replaced old exceptions.
+      </action>
       <action dev="erans" type="update" issue="MATH-310">
         Made "sample" methods part of the "IntegerDistribution" and
         "ContinuousDistribution" interfaces.

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/BlockFieldMatrixTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/BlockFieldMatrixTest.java?rev=1005028&r1=1005027&r2=1005028&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/BlockFieldMatrixTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/BlockFieldMatrixTest.java Wed Oct  6 13:30:03 2010
@@ -25,6 +25,11 @@ import org.apache.commons.math.TestUtils
 import org.apache.commons.math.fraction.Fraction;
 import org.apache.commons.math.fraction.FractionField;
 import org.apache.commons.math.exception.MatrixDimensionMismatchException;
+import org.apache.commons.math.exception.NoDataException;
+import org.apache.commons.math.exception.OutOfRangeException;
+import org.apache.commons.math.exception.NumberIsTooSmallException;
+import org.apache.commons.math.exception.NotStrictlyPositiveException;
+import org.apache.commons.math.exception.NullArgumentException;
 
 /**
  * Test cases for the {@link BlockFieldMatrix} class.
@@ -468,14 +473,14 @@ public final class BlockFieldMatrixTest 
         TestUtils.assertEquals(m.getColumn(2), testDataCol3);
         try {
             m.getRow(10);
-            fail("expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // ignored
         }
         try {
             m.getColumn(-1);
-            fail("expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // ignored
         }
     }
@@ -485,8 +490,8 @@ public final class BlockFieldMatrixTest 
         assertEquals(m.getEntry(0,1),new Fraction(2));
         try {
             m.getEntry(10, 4);
-            fail ("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail ("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
     }
@@ -566,9 +571,22 @@ public final class BlockFieldMatrixTest 
             if (reference != null) {
                 assertEquals(new BlockFieldMatrix<Fraction>(reference), sub);
             } else {
-                fail("Expecting MatrixIndexException");
+                fail("Expecting OutOfRangeException or NotStrictlyPositiveException"
+                     + " or NumberIsTooSmallException or NoDataException");
             }
-        } catch (MatrixIndexException e) {
+        } catch (OutOfRangeException e) {
+            if (reference != null) {
+                throw e;
+            }
+        } catch (NotStrictlyPositiveException e) {
+            if (reference != null) {
+                throw e;
+            }
+        } catch (NumberIsTooSmallException e) {
+            if (reference != null) {
+                throw e;
+            }
+        } catch (NoDataException e) {
             if (reference != null) {
                 throw e;
             }
@@ -582,9 +600,21 @@ public final class BlockFieldMatrixTest 
             if (reference != null) {
                 assertEquals(new BlockFieldMatrix<Fraction>(reference), sub);
             } else {
-                fail("Expecting MatrixIndexException");
+                fail("Expecting OutOfRangeException");
+            }
+        } catch (OutOfRangeException e) {
+            if (reference != null) {
+                throw e;
+            }
+        } catch (NotStrictlyPositiveException e) {
+            if (reference != null) {
+                throw e;
             }
-        } catch (MatrixIndexException e) {
+        } catch (NumberIsTooSmallException e) {
+            if (reference != null) {
+                throw e;
+            }
+        } catch (NoDataException e) {
             if (reference != null) {
                 throw e;
             }
@@ -628,7 +658,7 @@ public final class BlockFieldMatrixTest 
         checkCopy(m, null, -1, 1, 2, 2);
         checkCopy(m, null,  1, 0, 2, 2);
         checkCopy(m, null,  1, 0, 2, 4);
-        checkCopy(m, null, new int[] {},    new int[] { 0 });
+        checkCopy(m, null, new int[] {}, new int[] { 0 });
         checkCopy(m, null, new int[] { 0 }, new int[] { 4 });
     }
 
@@ -642,9 +672,17 @@ public final class BlockFieldMatrixTest 
             if (reference != null) {
                 assertEquals(new BlockFieldMatrix<Fraction>(reference), new BlockFieldMatrix<Fraction>(sub));
             } else {
-                fail("Expecting MatrixIndexException");
+                fail("Expecting OutOfRangeException or NumberIsTooSmallException or NoDataException");
+            }
+        } catch (OutOfRangeException e) {
+            if (reference != null) {
+                throw e;
             }
-        } catch (MatrixIndexException e) {
+        } catch (NumberIsTooSmallException e) {
+            if (reference != null) {
+                throw e;
+            }
+        } catch (NoDataException e) {
             if (reference != null) {
                 throw e;
             }
@@ -661,9 +699,17 @@ public final class BlockFieldMatrixTest 
             if (reference != null) {
                 assertEquals(new BlockFieldMatrix<Fraction>(reference), new BlockFieldMatrix<Fraction>(sub));
             } else {
-                fail("Expecting MatrixIndexException");
+                fail("Expecting OutOfRangeException or NumberIsTooSmallException or NoDataException");
+            }
+        } catch (OutOfRangeException e) {
+            if (reference != null) {
+                throw e;
+            }
+        } catch (NumberIsTooSmallException e) {
+            if (reference != null) {
+                throw e;
             }
-        } catch (MatrixIndexException e) {
+        } catch (NoDataException e) {
             if (reference != null) {
                 throw e;
             }
@@ -678,14 +724,14 @@ public final class BlockFieldMatrixTest 
         assertEquals("Row3", mRow3, m.getRowMatrix(3));
         try {
             m.getRowMatrix(-1);
-            fail("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
         try {
             m.getRowMatrix(4);
-            fail("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
     }
@@ -698,8 +744,8 @@ public final class BlockFieldMatrixTest 
         assertEquals(mRow3, m.getRowMatrix(0));
         try {
             m.setRowMatrix(-1, mRow3);
-            fail("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
         try {
@@ -739,14 +785,14 @@ public final class BlockFieldMatrixTest 
         assertEquals(mColumn3, m.getColumnMatrix(3));
         try {
             m.getColumnMatrix(-1);
-            fail("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
         try {
             m.getColumnMatrix(4);
-            fail("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
     }
@@ -759,8 +805,8 @@ public final class BlockFieldMatrixTest 
         assertEquals(mColumn3, m.getColumnMatrix(1));
         try {
             m.setColumnMatrix(-1, mColumn3);
-            fail("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
         try {
@@ -800,14 +846,14 @@ public final class BlockFieldMatrixTest 
         assertEquals(mRow3, m.getRowVector(3));
         try {
             m.getRowVector(-1);
-            fail("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
         try {
             m.getRowVector(4);
-            fail("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
     }
@@ -820,8 +866,8 @@ public final class BlockFieldMatrixTest 
         assertEquals(mRow3, m.getRowVector(0));
         try {
             m.setRowVector(-1, mRow3);
-            fail("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
         try {
@@ -859,14 +905,14 @@ public final class BlockFieldMatrixTest 
         assertEquals(mColumn3, m.getColumnVector(3));
         try {
             m.getColumnVector(-1);
-            fail("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
         try {
             m.getColumnVector(4);
-            fail("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
     }
@@ -879,8 +925,8 @@ public final class BlockFieldMatrixTest 
         assertEquals(mColumn3, m.getColumnVector(1));
         try {
             m.setColumnVector(-1, mColumn3);
-            fail("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
         try {
@@ -924,14 +970,14 @@ public final class BlockFieldMatrixTest 
         checkArrays(subRow3[0], m.getRow(3));
         try {
             m.getRow(-1);
-            fail("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
         try {
             m.getRow(4);
-            fail("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
     }
@@ -943,8 +989,8 @@ public final class BlockFieldMatrixTest 
         checkArrays(subRow3[0], m.getRow(0));
         try {
             m.setRow(-1, subRow3[0]);
-            fail("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
         try {
@@ -983,14 +1029,14 @@ public final class BlockFieldMatrixTest 
         checkArrays(mColumn3, m.getColumn(3));
         try {
             m.getColumn(-1);
-            fail("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
         try {
             m.getColumn(4);
-            fail("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
     }
@@ -1003,8 +1049,8 @@ public final class BlockFieldMatrixTest 
         checkArrays(mColumn3, m.getColumn(1));
         try {
             m.setColumn(-1, mColumn3);
-            fail("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
         try {
@@ -1107,21 +1153,21 @@ public final class BlockFieldMatrixTest 
         // dimension overflow
         try {
             m.setSubMatrix(testData,1,1);
-            fail("expecting MatrixIndexException");
-        } catch (MatrixIndexException e) {
+            fail("expecting OutOfRangeException");
+        } catch (OutOfRangeException e) {
             // expected
         }
         // dimension underflow
         try {
             m.setSubMatrix(testData,-1,1);
-            fail("expecting MatrixIndexException");
-        } catch (MatrixIndexException e) {
+            fail("expecting OutOfRangeException");
+        } catch (OutOfRangeException e) {
             // expected
         }
         try {
             m.setSubMatrix(testData,1,-1);
-            fail("expecting MatrixIndexException");
-        } catch (MatrixIndexException e) {
+            fail("expecting OutOfRangeException");
+        } catch (OutOfRangeException e) {
             // expected
         }
 



Mime
View raw message