commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r955423 [4/6] - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/ main/java/org/apache/commons/math/analysis/integration/ main/java/org/apache/commons/math/analysis/interpolation/ main/java/org/apache/commons/math/analys...
Date Wed, 16 Jun 2010 23:03:42 GMT
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/InvalidMatrixException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/InvalidMatrixException.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/InvalidMatrixException.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/InvalidMatrixException.java Wed Jun 16 23:03:38 2010
@@ -18,6 +18,8 @@
 package org.apache.commons.math.linear;
 
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.DummyLocalizable;
+import org.apache.commons.math.util.Localizable;
 
 /**
  * Thrown when a system attempts an operation on a matrix, and
@@ -28,7 +30,7 @@ import org.apache.commons.math.MathRunti
 public class InvalidMatrixException extends MathRuntimeException {
 
     /** Serializable version identifier. */
-    private static final long serialVersionUID = 1135533765052675495L;
+    private static final long serialVersionUID = -2068020346562029801L;
 
     /**
      * Construct an exception with the given message.
@@ -37,6 +39,16 @@ public class InvalidMatrixException exte
      * @since 2.0
      */
     public InvalidMatrixException(final String pattern, final Object ... arguments) {
+        this(new DummyLocalizable(pattern), arguments);
+    }
+
+    /**
+     * Construct an exception with the given message.
+     * @param pattern format specifier
+     * @param arguments format arguments
+     * @since 2.2
+     */
+    public InvalidMatrixException(final Localizable pattern, final Object ... arguments) {
         super(pattern, arguments);
     }
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/LUDecompositionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/LUDecompositionImpl.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/LUDecompositionImpl.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/LUDecompositionImpl.java Wed Jun 16 23:03:38 2010
@@ -18,6 +18,7 @@
 package org.apache.commons.math.linear;
 
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Calculates the LUP-decomposition of a square matrix.
@@ -36,10 +37,6 @@ public class LUDecompositionImpl impleme
     /** Default bound to determine effective singularity in LU decomposition */
     private static final double DEFAULT_TOO_SMALL = 10E-12;
 
-    /** Message for vector length mismatch. */
-    private static final String VECTOR_LENGTH_MISMATCH_MESSAGE =
-        "vector length mismatch: got {0} but expected {1}";
-
     /** Entries of LU decomposition. */
     private double lu[][];
 
@@ -266,7 +263,7 @@ public class LUDecompositionImpl impleme
             final int m = pivot.length;
             if (b.length != m) {
                 throw MathRuntimeException.createIllegalArgumentException(
-                        VECTOR_LENGTH_MISMATCH_MESSAGE, b.length, m);
+                        LocalizedFormats.VECTOR_LENGTH_MISMATCH, b.length, m);
             }
             if (singular) {
                 throw new SingularMatrixException();
@@ -310,7 +307,7 @@ public class LUDecompositionImpl impleme
                 final int m = pivot.length;
                 if (b.getDimension() != m) {
                     throw MathRuntimeException.createIllegalArgumentException(
-                            VECTOR_LENGTH_MISMATCH_MESSAGE, b.getDimension(), m);
+                            LocalizedFormats.VECTOR_LENGTH_MISMATCH, b.getDimension(), m);
                 }
                 if (singular) {
                     throw new SingularMatrixException();
@@ -364,7 +361,7 @@ public class LUDecompositionImpl impleme
             final int m = pivot.length;
             if (b.getRowDimension() != m) {
                 throw MathRuntimeException.createIllegalArgumentException(
-                        "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+                        LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
                         b.getRowDimension(), b.getColumnDimension(), m, "n");
             }
             if (singular) {

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/MatrixIndexException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/MatrixIndexException.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/MatrixIndexException.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/MatrixIndexException.java Wed Jun 16 23:03:38 2010
@@ -18,6 +18,8 @@
 package org.apache.commons.math.linear;
 
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.DummyLocalizable;
+import org.apache.commons.math.util.Localizable;
 
 /**
  * Thrown when an operation addresses a matrix coordinate (row, col)
@@ -27,7 +29,7 @@ import org.apache.commons.math.MathRunti
 public class MatrixIndexException extends MathRuntimeException {
 
     /** Serializable version identifier */
-    private static final long serialVersionUID = -2382324504109300625L;
+    private static final long serialVersionUID = 8120540015829487660L;
 
     /**
      * Constructs a new instance with specified formatted detail message.
@@ -35,6 +37,16 @@ public class MatrixIndexException extend
      * @param arguments format arguments
      */
     public MatrixIndexException(final String pattern, final Object ... arguments) {
+      this(new DummyLocalizable(pattern), arguments);
+    }
+
+    /**
+     * Constructs a new instance with specified formatted detail message.
+     * @param pattern format specifier
+     * @param arguments format arguments
+     * @since 2.0
+     */
+    public MatrixIndexException(final Localizable pattern, final Object ... arguments) {
       super(pattern, arguments);
     }
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/MatrixUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/MatrixUtils.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/MatrixUtils.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/MatrixUtils.java Wed Jun 16 23:03:38 2010
@@ -29,6 +29,7 @@ import org.apache.commons.math.FieldElem
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.fraction.BigFraction;
 import org.apache.commons.math.fraction.Fraction;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * A collection of static methods that operate on or return matrices.
@@ -352,7 +353,7 @@ public class MatrixUtils {
         createRowFieldMatrix(final T[] rowData) {
         final int nCols = rowData.length;
         if (nCols == 0) {
-            throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one column");
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
         }
         final FieldMatrix<T> m = createFieldMatrix(rowData[0].getField(), 1, nCols);
         for (int i = 0; i < nCols; ++i) {
@@ -451,7 +452,7 @@ public class MatrixUtils {
         createColumnFieldMatrix(final T[] columnData) {
         final int nRows = columnData.length;
         if (nRows == 0) {
-            throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one row");
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.AT_LEAST_ONE_ROW);
         }
         final FieldMatrix<T> m = createFieldMatrix(columnData[0].getField(), nRows, 1);
         for (int i = 0; i < nRows; ++i) {
@@ -564,14 +565,14 @@ public class MatrixUtils {
         checkRowIndex(m, startRow);
         checkRowIndex(m, endRow);
         if (startRow > endRow) {
-            throw new MatrixIndexException("initial row {0} after final row {1}",
+            throw new MatrixIndexException(LocalizedFormats.INITIAL_ROW_AFTER_FINAL_ROW,
                                            startRow, endRow);
         }
 
         checkColumnIndex(m, startColumn);
         checkColumnIndex(m, endColumn);
         if (startColumn > endColumn) {
-            throw new MatrixIndexException("initial column {0} after final column {1}",
+            throw new MatrixIndexException(LocalizedFormats.INITIAL_COLUMN_AFTER_FINAL_COLUMN,
                                            startColumn, endColumn);
         }
 
@@ -592,9 +593,9 @@ public class MatrixUtils {
         throws MatrixIndexException {
         if (selectedRows.length * selectedColumns.length == 0) {
             if (selectedRows.length == 0) {
-                throw new MatrixIndexException("empty selected row index array");
+                throw new MatrixIndexException(LocalizedFormats.EMPTY_SELECTED_ROW_INDEX_ARRAY);
             }
-            throw new MatrixIndexException("empty selected column index array");
+            throw new MatrixIndexException(LocalizedFormats.EMPTY_SELECTED_COLUMN_INDEX_ARRAY);
         }
 
         for (final int row : selectedRows) {
@@ -616,7 +617,7 @@ public class MatrixUtils {
         if ((left.getRowDimension()    != right.getRowDimension()) ||
             (left.getColumnDimension() != right.getColumnDimension())) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "{0}x{1} and {2}x{3} matrices are not addition compatible",
+                    LocalizedFormats.NOT_ADDITION_COMPATIBLE_MATRICES,
                     left.getRowDimension(), left.getColumnDimension(),
                     right.getRowDimension(), right.getColumnDimension());
         }
@@ -633,7 +634,7 @@ public class MatrixUtils {
         if ((left.getRowDimension()    != right.getRowDimension()) ||
             (left.getColumnDimension() != right.getColumnDimension())) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "{0}x{1} and {2}x{3} matrices are not subtraction compatible",
+                    LocalizedFormats.NOT_SUBTRACTION_COMPATIBLE_MATRICES,
                     left.getRowDimension(), left.getColumnDimension(),
                     right.getRowDimension(), right.getColumnDimension());
         }
@@ -649,7 +650,7 @@ public class MatrixUtils {
         throws IllegalArgumentException {
         if (left.getColumnDimension() != right.getRowDimension()) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "{0}x{1} and {2}x{3} matrices are not multiplication compatible",
+                    LocalizedFormats.NOT_MULTIPLICATION_COMPATIBLE_MATRICES,
                     left.getRowDimension(), left.getColumnDimension(),
                     right.getRowDimension(), right.getColumnDimension());
         }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/MatrixVisitorException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/MatrixVisitorException.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/MatrixVisitorException.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/MatrixVisitorException.java Wed Jun 16 23:03:38 2010
@@ -18,6 +18,7 @@
 package org.apache.commons.math.linear;
 
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.Localizable;
 
 /**
  * Thrown when a visitor encounters an error while processing a matrix entry.
@@ -32,9 +33,21 @@ public class MatrixVisitorException exte
      * Constructs a new instance with specified formatted detail message.
      * @param pattern format specifier
      * @param arguments format arguments
+     * @deprecated as of 2.2 replaced by {@link #MatrixVisitorException(Localizable, Object...)}
      */
+    @Deprecated
     public MatrixVisitorException(final String pattern, final Object[] arguments) {
       super(pattern, arguments);
     }
 
+    /**
+     * Constructs a new instance with specified formatted detail message.
+     * @param pattern format specifier
+     * @param arguments format arguments
+     * @since 2.2
+     */
+    public MatrixVisitorException(final Localizable pattern, final Object[] arguments) {
+      super(pattern, arguments);
+    }
+
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonSquareMatrixException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonSquareMatrixException.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonSquareMatrixException.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonSquareMatrixException.java Wed Jun 16 23:03:38 2010
@@ -17,6 +17,8 @@
 
 package org.apache.commons.math.linear;
 
+import org.apache.commons.math.util.LocalizedFormats;
+
 
 /**
  * Thrown when an operation defined only for square matrices is applied to non-square ones.
@@ -34,8 +36,7 @@ public class NonSquareMatrixException ex
      * @param columns number of columns of the faulty matrix
      */
     public NonSquareMatrixException(final int rows, final int columns) {
-        super("a {0}x{1} matrix was provided instead of a square matrix",
-              rows, columns);
+        super(LocalizedFormats.NON_SQUARE_MATRIX, rows, columns);
     }
 
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NotPositiveDefiniteMatrixException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NotPositiveDefiniteMatrixException.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NotPositiveDefiniteMatrixException.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NotPositiveDefiniteMatrixException.java Wed Jun 16 23:03:38 2010
@@ -18,6 +18,7 @@
 package org.apache.commons.math.linear;
 
 import org.apache.commons.math.MathException;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * This class represents exceptions thrown when a matrix expected to
@@ -36,7 +37,7 @@ public class NotPositiveDefiniteMatrixEx
      * build an exception with a default message.
      */
     public NotPositiveDefiniteMatrixException() {
-        super("not positive definite matrix");
+        super(LocalizedFormats.NOT_POSITIVE_DEFINITE_MATRIX);
     }
 
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NotSymmetricMatrixException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NotSymmetricMatrixException.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NotSymmetricMatrixException.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NotSymmetricMatrixException.java Wed Jun 16 23:03:38 2010
@@ -18,6 +18,7 @@
 package org.apache.commons.math.linear;
 
 import org.apache.commons.math.MathException;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * This class represents exceptions thrown when a matrix expected to
@@ -36,7 +37,7 @@ public class NotSymmetricMatrixException
      * build an exception with a default message.
      */
     public NotSymmetricMatrixException() {
-        super("not symmetric matrix");
+        super(LocalizedFormats.NOT_SYMMETRIC_MATRIX);
     }
 
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/OpenMapRealVector.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/OpenMapRealVector.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/OpenMapRealVector.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/OpenMapRealVector.java Wed Jun 16 23:03:38 2010
@@ -19,6 +19,7 @@ package org.apache.commons.math.linear;
 import java.io.Serializable;
 
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.LocalizedFormats;
 import org.apache.commons.math.util.OpenIntToDoubleHashMap;
 import org.apache.commons.math.util.OpenIntToDoubleHashMap.Iterator;
 
@@ -732,7 +733,7 @@ public class OpenMapRealVector extends A
     public void unitize() {
         double norm = getNorm();
         if (isDefaultValue(norm)) {
-            throw  MathRuntimeException.createArithmeticException("cannot normalize a zero norm vector");
+            throw  MathRuntimeException.createArithmeticException(LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR);
         }
         Iterator iter = entries.iterator();
         while (iter.hasNext()) {

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/QRDecompositionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/QRDecompositionImpl.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/QRDecompositionImpl.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/QRDecompositionImpl.java Wed Jun 16 23:03:38 2010
@@ -20,6 +20,7 @@ package org.apache.commons.math.linear;
 import java.util.Arrays;
 
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.LocalizedFormats;
 
 
 /**
@@ -290,7 +291,7 @@ public class QRDecompositionImpl impleme
             final int m = qrt[0].length;
             if (b.length != m) {
                 throw MathRuntimeException.createIllegalArgumentException(
-                        "vector length mismatch: got {0} but expected {1}",
+                        LocalizedFormats.VECTOR_LENGTH_MISMATCH,
                         b.length, m);
             }
             if (!isNonSingular()) {
@@ -361,7 +362,7 @@ public class QRDecompositionImpl impleme
             final int m = qrt[0].length;
             if (b.getRowDimension() != m) {
                 throw MathRuntimeException.createIllegalArgumentException(
-                        "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+                        LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
                         b.getRowDimension(), b.getColumnDimension(), m, "n");
             }
             if (!isNonSingular()) {

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealMatrixImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealMatrixImpl.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealMatrixImpl.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealMatrixImpl.java Wed Jun 16 23:03:38 2010
@@ -20,6 +20,7 @@ package org.apache.commons.math.linear;
 import java.io.Serializable;
 
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Implementation of RealMatrix using a double[][] array to store entries and
@@ -122,16 +123,16 @@ public class RealMatrixImpl extends Abst
             }
             final int nRows = d.length;
             if (nRows == 0) {
-                throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one row");
+                throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.AT_LEAST_ONE_ROW);
             }
             final int nCols = d[0].length;
             if (nCols == 0) {
-                throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one column");
+                throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
             }
             for (int r = 1; r < nRows; r++) {
                 if (d[r].length != nCols) {
                     throw MathRuntimeException.createIllegalArgumentException(
-                            "some rows have length {0} while others have length {1}",
+                            LocalizedFormats.DIFFERENT_ROWS_LENGTHS,
                             nCols, d[r].length);
                 }
             }
@@ -316,28 +317,28 @@ public class RealMatrixImpl extends Abst
         if (data == null) {
             if (row > 0) {
                 throw MathRuntimeException.createIllegalStateException(
-                        "first {0} rows are not initialized yet",
+                        LocalizedFormats.FIRST_ROWS_NOT_INITIALIZED_YET,
                         row);
             }
             if (column > 0) {
                 throw MathRuntimeException.createIllegalStateException(
-                        "first {0} columns are not initialized yet",
+                        LocalizedFormats.FIRST_COLUMNS_NOT_INITIALIZED_YET,
                         column);
             }
             final int nRows = subMatrix.length;
             if (nRows == 0) {
-                throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one row");
+                throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.AT_LEAST_ONE_ROW);
             }
 
             final int nCols = subMatrix[0].length;
             if (nCols == 0) {
-                throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one column");
+                throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
             }
             data = new double[subMatrix.length][nCols];
             for (int i = 0; i < data.length; ++i) {
                 if (subMatrix[i].length != nCols) {
                     throw MathRuntimeException.createIllegalArgumentException(
-                            "some rows have length {0} while others have length {1}",
+                            LocalizedFormats.DIFFERENT_ROWS_LENGTHS,
                             nCols, subMatrix[i].length);
                 }
                 System.arraycopy(subMatrix[i], 0, data[i + row], column, nCols);
@@ -356,7 +357,7 @@ public class RealMatrixImpl extends Abst
             return data[row][column];
         } catch (ArrayIndexOutOfBoundsException e) {
             throw new MatrixIndexException(
-                    "no entry at indices ({0}, {1}) in a {2}x{3} matrix",
+                    LocalizedFormats.NO_SUCH_MATRIX_ENTRY,
                     row, column, getRowDimension(), getColumnDimension());
         }
     }
@@ -369,7 +370,7 @@ public class RealMatrixImpl extends Abst
             data[row][column] = value;
         } catch (ArrayIndexOutOfBoundsException e) {
             throw new MatrixIndexException(
-                    "no entry at indices ({0}, {1}) in a {2}x{3} matrix",
+                    LocalizedFormats.NO_SUCH_MATRIX_ENTRY,
                     row, column, getRowDimension(), getColumnDimension());
         }
     }
@@ -382,7 +383,7 @@ public class RealMatrixImpl extends Abst
             data[row][column] += increment;
         } catch (ArrayIndexOutOfBoundsException e) {
             throw new MatrixIndexException(
-                    "no entry at indices ({0}, {1}) in a {2}x{3} matrix",
+                    LocalizedFormats.NO_SUCH_MATRIX_ENTRY,
                     row, column, getRowDimension(), getColumnDimension());
         }
     }
@@ -395,7 +396,7 @@ public class RealMatrixImpl extends Abst
             data[row][column] *= factor;
         } catch (ArrayIndexOutOfBoundsException e) {
             throw new MatrixIndexException(
-                    "no entry at indices ({0}, {1}) in a {2}x{3} matrix",
+                    LocalizedFormats.NO_SUCH_MATRIX_ENTRY,
                     row, column, getRowDimension(), getColumnDimension());
         }
     }
@@ -420,7 +421,7 @@ public class RealMatrixImpl extends Abst
         final int nCols = this.getColumnDimension();
         if (v.length != nCols) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "vector length mismatch: got {0} but expected {1}",
+                    LocalizedFormats.VECTOR_LENGTH_MISMATCH,
                     v.length, nCols);
         }
         final double[] out = new double[nRows];
@@ -444,7 +445,7 @@ public class RealMatrixImpl extends Abst
         final int nCols = getColumnDimension();
         if (v.length != nRows) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "vector length mismatch: got {0} but expected {1}",
+                    LocalizedFormats.VECTOR_LENGTH_MISMATCH,
                     v.length, nRows);
         }
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealVectorFormat.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealVectorFormat.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealVectorFormat.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealVectorFormat.java Wed Jun 16 23:03:38 2010
@@ -27,6 +27,7 @@ import java.util.Locale;
 
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.util.CompositeFormat;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Formats a vector in components list format "{v0; v1; ...; vk-1}".
@@ -246,7 +247,7 @@ public class RealVectorFormat extends Co
         }
 
         throw MathRuntimeException.createIllegalArgumentException(
-              "cannot format a {0} instance as a real vector",
+              LocalizedFormats.CANNOT_FORMAT_INSTANCE_AS_REAL_VECTOR,
               obj.getClass().getName());
 
     }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularMatrixException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularMatrixException.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularMatrixException.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularMatrixException.java Wed Jun 16 23:03:38 2010
@@ -17,6 +17,8 @@
 
 package org.apache.commons.math.linear;
 
+import org.apache.commons.math.util.LocalizedFormats;
+
 
 /**
  * Thrown when a matrix is singular.
@@ -32,7 +34,7 @@ public class SingularMatrixException ext
      * Construct an exception with a default message.
      */
     public SingularMatrixException() {
-        super("matrix is singular");
+        super(LocalizedFormats.SINGULAR_MATRIX);
     }
 
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularValueDecompositionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularValueDecompositionImpl.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularValueDecompositionImpl.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularValueDecompositionImpl.java Wed Jun 16 23:03:38 2010
@@ -18,6 +18,7 @@
 package org.apache.commons.math.linear;
 
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Calculates the compact Singular Value Decomposition of a matrix.
@@ -219,7 +220,7 @@ public class SingularValueDecompositionI
 
         if (dimension == 0) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "cutoff singular value is {0}, should be at most {1}",
+                    LocalizedFormats.TOO_LARGE_CUTOFF_SINGULAR_VALUE,
                     minSingularValue, singularValues[0]);
         }
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SparseFieldVector.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SparseFieldVector.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SparseFieldVector.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SparseFieldVector.java Wed Jun 16 23:03:38 2010
@@ -22,6 +22,7 @@ import java.lang.reflect.Array;
 import org.apache.commons.math.Field;
 import org.apache.commons.math.FieldElement;
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.LocalizedFormats;
 import org.apache.commons.math.util.OpenIntToFieldHashMap;
 
 /**
@@ -565,7 +566,7 @@ public class SparseFieldVector<T extends
     protected void checkVectorDimensions(int n) throws IllegalArgumentException {
         if (getDimension() != n) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "vector length mismatch: got {0} but expected {1}",
+                    LocalizedFormats.VECTOR_LENGTH_MISMATCH,
                     getDimension(), n);
         }
     }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/AbstractIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/AbstractIntegrator.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/AbstractIntegrator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/AbstractIntegrator.java Wed Jun 16 23:03:38 2010
@@ -26,6 +26,7 @@ import org.apache.commons.math.ode.event
 import org.apache.commons.math.ode.events.EventHandler;
 import org.apache.commons.math.ode.events.EventState;
 import org.apache.commons.math.ode.sampling.StepHandler;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Base class managing common boilerplate for all integrators.
@@ -197,21 +198,17 @@ public abstract class AbstractIntegrator
 
         if (ode.getDimension() != y0.length) {
             throw new IntegratorException(
-                    "dimensions mismatch: ODE problem has dimension {0}," +
-                    " initial state vector has dimension {1}",
-                    ode.getDimension(), y0.length);
+                    LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, ode.getDimension(), y0.length);
         }
 
         if (ode.getDimension() != y.length) {
             throw new IntegratorException(
-                    "dimensions mismatch: ODE problem has dimension {0}," +
-                    " final state vector has dimension {1}",
-                    ode.getDimension(), y.length);
+                    LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, ode.getDimension(), y.length);
         }
 
         if (Math.abs(t - t0) <= 1.0e-12 * Math.max(Math.abs(t0), Math.abs(t))) {
             throw new IntegratorException(
-                    "too small integration interval: length = {0}",
+                    LocalizedFormats.TOO_SMALL_INTEGRATION_INTERVAL,
                     Math.abs(t - t0));
         }
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/ContinuousOutputModel.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/ContinuousOutputModel.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/ContinuousOutputModel.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/ContinuousOutputModel.java Wed Jun 16 23:03:38 2010
@@ -24,6 +24,7 @@ import java.io.Serializable;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.ode.sampling.StepHandler;
 import org.apache.commons.math.ode.sampling.StepInterpolator;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * This class stores all information provided by an ODE integrator
@@ -134,13 +135,13 @@ public class ContinuousOutputModel
 
       if (getInterpolatedState().length != model.getInterpolatedState().length) {
           throw MathRuntimeException.createIllegalArgumentException(
-                "dimension mismatch {0} != {1}",
+                LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE,
                 getInterpolatedState().length, model.getInterpolatedState().length);
       }
 
       if (forward ^ model.forward) {
           throw MathRuntimeException.createIllegalArgumentException(
-                "propagation direction mismatch");
+                LocalizedFormats.PROPAGATION_DIRECTION_MISMATCH);
       }
 
       final StepInterpolator lastInterpolator = steps.get(index);
@@ -150,7 +151,7 @@ public class ContinuousOutputModel
       final double gap = model.getInitialTime() - current;
       if (Math.abs(gap) > 1.0e-3 * Math.abs(step)) {
         throw MathRuntimeException.createIllegalArgumentException(
-              "{0} wide hole between models time ranges", Math.abs(gap));
+              LocalizedFormats.HOLE_BETWEEN_MODELS_TIME_RANGES, Math.abs(gap));
       }
 
     }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/DerivativeException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/DerivativeException.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/DerivativeException.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/DerivativeException.java Wed Jun 16 23:03:38 2010
@@ -18,6 +18,8 @@
 package org.apache.commons.math.ode;
 
 import org.apache.commons.math.MathException;
+import org.apache.commons.math.util.DummyLocalizable;
+import org.apache.commons.math.util.Localizable;
 
 /**
  * This exception is made available to users to report
@@ -36,12 +38,23 @@ public class DerivativeException
    * Build an exception by translating and formating a message
    * @param specifier format specifier (to be translated)
    * @param parts to insert in the format (no translation)
+   * @deprecated as of 2.2 replaced by {@link #DerivativeException(Localizable, Object...)}
    */
+  @Deprecated
   public DerivativeException(final String specifier, final Object ... parts) {
+    this(new DummyLocalizable(specifier), parts);
+  }
+
+  /** Simple constructor.
+   * Build an exception by translating and formating a message
+   * @param specifier format specifier (to be translated)
+   * @param parts to insert in the format (no translation)
+   */
+  public DerivativeException(final Localizable specifier, final Object ... parts) {
     super(specifier, parts);
   }
 
-  /** Build an instance from an underlying cause.
+ /** Build an instance from an underlying cause.
    * @param cause cause for the exception
    */
   public DerivativeException(final Throwable cause) {

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/IntegratorException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/IntegratorException.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/IntegratorException.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/IntegratorException.java Wed Jun 16 23:03:38 2010
@@ -18,6 +18,7 @@
 package org.apache.commons.math.ode;
 
 import org.apache.commons.math.MathException;
+import org.apache.commons.math.util.Localizable;
 
 /**
  * This exception is made available to users to report
@@ -31,14 +32,25 @@ public class IntegratorException
   /** Serializable version identifier */
     private static final long serialVersionUID = -1607588949778036796L;
 
-  /** Simple constructor.
-   * Build an exception by translating and formating a message
-   * @param specifier format specifier (to be translated)
-   * @param parts to insert in the format (no translation)
-   */
-  public IntegratorException(final String specifier, final Object ... parts) {
-    super(specifier, parts);
-  }
+    /** Simple constructor.
+     * Build an exception by translating and formating a message
+     * @param specifier format specifier (to be translated)
+     * @param parts to insert in the format (no translation)
+     * @deprecated as of 2.2 replaced by {@link #IntegratorException(Localizable, Object...)}
+     */
+    @Deprecated
+    public IntegratorException(final String specifier, final Object ... parts) {
+      super(specifier, parts);
+    }
+
+    /** Simple constructor.
+     * Build an exception by translating and formating a message
+     * @param specifier format specifier (to be translated)
+     * @param parts to insert in the format (no translation)
+     */
+    public IntegratorException(final Localizable specifier, final Object ... parts) {
+      super(specifier, parts);
+    }
 
   /**
    * Create an exception with a given root cause.

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/MultistepIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/MultistepIntegrator.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/MultistepIntegrator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/MultistepIntegrator.java Wed Jun 16 23:03:38 2010
@@ -24,6 +24,7 @@ import org.apache.commons.math.ode.nonst
 import org.apache.commons.math.ode.nonstiff.DormandPrince853Integrator;
 import org.apache.commons.math.ode.sampling.StepHandler;
 import org.apache.commons.math.ode.sampling.StepInterpolator;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * This class is the base class for multistep integrators for Ordinary
@@ -113,7 +114,7 @@ public abstract class MultistepIntegrato
 
         if (nSteps <= 0) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "{0} method needs at least one previous point",
+                  LocalizedFormats.INTEGRATION_METHOD_NEEDS_AT_LEAST_ONE_PREVIOUS_POINT,
                   name);
         }
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/events/EventException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/events/EventException.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/events/EventException.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/events/EventException.java Wed Jun 16 23:03:38 2010
@@ -18,6 +18,7 @@
 package org.apache.commons.math.ode.events;
 
 import org.apache.commons.math.MathException;
+import org.apache.commons.math.util.Localizable;
 
 /**
  * This exception is made available to users to report
@@ -34,11 +35,23 @@ public class EventException extends Math
      * Build an exception by translating and formating a message
      * @param specifier format specifier (to be translated)
      * @param parts to insert in the format (no translation)
+     * @deprecated as of 2.2 replaced by {@link #EventException(Localizable, Object...)}
      */
+     @Deprecated
     public EventException(final String specifier, final Object ... parts) {
         super(specifier, parts);
     }
 
+    /** Simple constructor.
+     * Build an exception by translating and formating a message
+     * @param specifier format specifier (to be translated)
+     * @param parts to insert in the format (no translation)
+     * @since 2.2
+     */
+    public EventException(final Localizable specifier, final Object ... parts) {
+        super(specifier, parts);
+    }
+
     /**
      * Create an exception with a given root cause.
      * @param cause  the exception or error that caused this exception to be thrown

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/jacobians/FirstOrderIntegratorWithJacobians.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/jacobians/FirstOrderIntegratorWithJacobians.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/jacobians/FirstOrderIntegratorWithJacobians.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/jacobians/FirstOrderIntegratorWithJacobians.java Wed Jun 16 23:03:38 2010
@@ -34,6 +34,7 @@ import org.apache.commons.math.ode.event
 import org.apache.commons.math.ode.events.EventHandler;
 import org.apache.commons.math.ode.sampling.StepHandler;
 import org.apache.commons.math.ode.sampling.StepInterpolator;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /** This class enhances a first order integrator for differential equations to
  * compute also partial derivatives of the solution with respect to initial state
@@ -348,7 +349,7 @@ public class FirstOrderIntegratorWithJac
         int arrayDimension = (array == null) ? 0 : Array.getLength(array);
         if (arrayDimension != expected) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "dimension mismatch {0} != {1}", arrayDimension, expected);
+                  LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, arrayDimension, expected);
         }
     }
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/AdaptiveStepsizeIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/AdaptiveStepsizeIntegrator.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/AdaptiveStepsizeIntegrator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/AdaptiveStepsizeIntegrator.java Wed Jun 16 23:03:38 2010
@@ -21,6 +21,7 @@ import org.apache.commons.math.ode.Abstr
 import org.apache.commons.math.ode.DerivativeException;
 import org.apache.commons.math.ode.FirstOrderDifferentialEquations;
 import org.apache.commons.math.ode.IntegratorException;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * This abstract class holds the common part of all adaptive
@@ -172,16 +173,12 @@ public abstract class AdaptiveStepsizeIn
 
       if ((vecAbsoluteTolerance != null) && (vecAbsoluteTolerance.length != y0.length)) {
           throw new IntegratorException(
-                  "dimensions mismatch: state vector has dimension {0}," +
-                  " absolute tolerance vector has dimension {1}",
-                  y0.length, vecAbsoluteTolerance.length);
+                  LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, y0.length, vecAbsoluteTolerance.length);
       }
 
       if ((vecRelativeTolerance != null) && (vecRelativeTolerance.length != y0.length)) {
           throw new IntegratorException(
-                  "dimensions mismatch: state vector has dimension {0}," +
-                  " relative tolerance vector has dimension {1}",
-                  y0.length, vecRelativeTolerance.length);
+                  LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, y0.length, vecRelativeTolerance.length);
       }
 
   }
@@ -283,7 +280,7 @@ public abstract class AdaptiveStepsizeIn
               filteredH = forward ? minStep : -minStep;
           } else {
               throw new IntegratorException(
-                      "minimal step size ({0,number,0.00E00}) reached, integration needs {1,number,0.00E00}",
+                      LocalizedFormats.MINIMAL_STEPSIZE_REACHED_DURING_INTEGRATION,
                       minStep, Math.abs(h));
           }
       }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/LeastSquaresConverter.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/LeastSquaresConverter.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/LeastSquaresConverter.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/LeastSquaresConverter.java Wed Jun 16 23:03:38 2010
@@ -22,6 +22,7 @@ import org.apache.commons.math.MathRunti
 import org.apache.commons.math.analysis.MultivariateRealFunction;
 import org.apache.commons.math.analysis.MultivariateVectorialFunction;
 import org.apache.commons.math.linear.RealMatrix;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /** This class converts {@link MultivariateVectorialFunction vectorial
  * objective functions} to {@link MultivariateRealFunction scalar objective functions}
@@ -113,7 +114,7 @@ public class LeastSquaresConverter imple
         throws IllegalArgumentException {
         if (observations.length != weights.length) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "dimension mismatch {0} != {1}",
+                    LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE,
                     observations.length, weights.length);
         }
         this.function     = function;
@@ -146,7 +147,7 @@ public class LeastSquaresConverter imple
         throws IllegalArgumentException {
         if (observations.length != scale.getColumnDimension()) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "dimension mismatch {0} != {1}",
+                    LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE,
                     observations.length, scale.getColumnDimension());
         }
         this.function     = function;
@@ -161,7 +162,7 @@ public class LeastSquaresConverter imple
         // compute residuals
         final double[] residuals = function.value(point);
         if (residuals.length != observations.length) {
-            throw new FunctionEvaluationException(point, "dimension mismatch {0} != {1}",
+            throw new FunctionEvaluationException(point, LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE,
                                                   residuals.length, observations.length);
         }
         for (int i = 0; i < residuals.length; ++i) {

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/MultiStartDifferentiableMultivariateRealOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/MultiStartDifferentiableMultivariateRealOptimizer.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/MultiStartDifferentiableMultivariateRealOptimizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/MultiStartDifferentiableMultivariateRealOptimizer.java Wed Jun 16 23:03:38 2010
@@ -24,6 +24,7 @@ import org.apache.commons.math.FunctionE
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.analysis.DifferentiableMultivariateRealFunction;
 import org.apache.commons.math.random.RandomVectorGenerator;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Special implementation of the {@link DifferentiableMultivariateRealOptimizer} interface adding
@@ -117,7 +118,7 @@ public class MultiStartDifferentiableMul
      */
     public RealPointValuePair[] getOptima() throws IllegalStateException {
         if (optima == null) {
-            throw MathRuntimeException.createIllegalStateException("no optimum computed yet");
+            throw MathRuntimeException.createIllegalStateException(LocalizedFormats.NO_OPTIMUM_COMPUTED_YET);
         }
         return optima.clone();
     }
@@ -215,7 +216,7 @@ public class MultiStartDifferentiableMul
 
         if (optima[0] == null) {
             throw new OptimizationException(
-                    "none of the {0} start points lead to convergence",
+                    LocalizedFormats.NO_CONVERGENCE_WITH_ANY_START_POINT,
                     starts);
         }
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/MultiStartDifferentiableMultivariateVectorialOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/MultiStartDifferentiableMultivariateVectorialOptimizer.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/MultiStartDifferentiableMultivariateVectorialOptimizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/MultiStartDifferentiableMultivariateVectorialOptimizer.java Wed Jun 16 23:03:38 2010
@@ -24,6 +24,7 @@ import org.apache.commons.math.FunctionE
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.analysis.DifferentiableMultivariateVectorialFunction;
 import org.apache.commons.math.random.RandomVectorGenerator;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Special implementation of the {@link DifferentiableMultivariateVectorialOptimizer} interface adding
@@ -121,7 +122,7 @@ public class MultiStartDifferentiableMul
      */
     public VectorialPointValuePair[] getOptima() throws IllegalStateException {
         if (optima == null) {
-            throw MathRuntimeException.createIllegalStateException("no optimum computed yet");
+            throw MathRuntimeException.createIllegalStateException(LocalizedFormats.NO_OPTIMUM_COMPUTED_YET);
         }
         return optima.clone();
     }
@@ -225,7 +226,7 @@ public class MultiStartDifferentiableMul
 
         if (optima[0] == null) {
             throw new OptimizationException(
-                    "none of the {0} start points lead to convergence",
+                    LocalizedFormats.NO_CONVERGENCE_WITH_ANY_START_POINT,
                     starts);
         }
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/MultiStartMultivariateRealOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/MultiStartMultivariateRealOptimizer.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/MultiStartMultivariateRealOptimizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/MultiStartMultivariateRealOptimizer.java Wed Jun 16 23:03:38 2010
@@ -24,6 +24,7 @@ import org.apache.commons.math.FunctionE
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.analysis.MultivariateRealFunction;
 import org.apache.commons.math.random.RandomVectorGenerator;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Special implementation of the {@link MultivariateRealOptimizer} interface adding
@@ -112,7 +113,7 @@ public class MultiStartMultivariateRealO
      */
     public RealPointValuePair[] getOptima() throws IllegalStateException {
         if (optima == null) {
-            throw MathRuntimeException.createIllegalStateException("no optimum computed yet");
+            throw MathRuntimeException.createIllegalStateException(LocalizedFormats.NO_OPTIMUM_COMPUTED_YET);
         }
         return optima.clone();
     }
@@ -203,7 +204,7 @@ public class MultiStartMultivariateRealO
 
         if (optima[0] == null) {
             throw new OptimizationException(
-                    "none of the {0} start points lead to convergence",
+                    LocalizedFormats.NO_CONVERGENCE_WITH_ANY_START_POINT,
                     starts);
         }
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/MultiStartUnivariateRealOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/MultiStartUnivariateRealOptimizer.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/MultiStartUnivariateRealOptimizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/MultiStartUnivariateRealOptimizer.java Wed Jun 16 23:03:38 2010
@@ -22,6 +22,7 @@ import org.apache.commons.math.FunctionE
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
 import org.apache.commons.math.random.RandomGenerator;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Special implementation of the {@link UnivariateRealOptimizer} interface adding
@@ -190,7 +191,7 @@ public class MultiStartUnivariateRealOpt
      */
     public double[] getOptima() throws IllegalStateException {
         if (optima == null) {
-            throw MathRuntimeException.createIllegalStateException("no optimum computed yet");
+            throw MathRuntimeException.createIllegalStateException(LocalizedFormats.NO_OPTIMUM_COMPUTED_YET);
         }
         return optima.clone();
     }
@@ -216,7 +217,7 @@ public class MultiStartUnivariateRealOpt
      */
     public double[] getOptimaValues() throws IllegalStateException {
         if (optimaValues == null) {
-            throw MathRuntimeException.createIllegalStateException("no optimum computed yet");
+            throw MathRuntimeException.createIllegalStateException(LocalizedFormats.NO_OPTIMUM_COMPUTED_YET);
         }
         return optimaValues.clone();
     }
@@ -299,7 +300,7 @@ public class MultiStartUnivariateRealOpt
 
         if (Double.isNaN(optima[0])) {
             throw new OptimizationException(
-                    "none of the {0} start points lead to convergence",
+                    LocalizedFormats.NO_CONVERGENCE_WITH_ANY_START_POINT,
                     starts);
         }
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/OptimizationException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/OptimizationException.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/OptimizationException.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/OptimizationException.java Wed Jun 16 23:03:38 2010
@@ -18,6 +18,8 @@
 package org.apache.commons.math.optimization;
 
 import org.apache.commons.math.ConvergenceException;
+import org.apache.commons.math.util.DummyLocalizable;
+import org.apache.commons.math.util.Localizable;
 
 /**
  * This class represents exceptions thrown by optimizers.
@@ -30,15 +32,28 @@ import org.apache.commons.math.Convergen
 public class OptimizationException extends ConvergenceException {
 
     /** Serializable version identifier. */
-    private static final long serialVersionUID = -357696069587075016L;
+    private static final long serialVersionUID = -4605887730798282127L;
 
     /**
      * Simple constructor.
      * Build an exception by translating and formating a message
      * @param specifier format specifier (to be translated)
      * @param parts to insert in the format (no translation)
+     * @deprecated as of 2.2 replaced by {@link #OptimizationException(Localizable, Object...)}
      */
+    @Deprecated
     public OptimizationException(String specifier, Object ... parts) {
+        this(new DummyLocalizable(specifier), parts);
+    }
+
+    /**
+     * Simple constructor.
+     * Build an exception by translating and formating a message
+     * @param specifier format specifier (to be translated)
+     * @param parts to insert in the format (no translation)
+     * @since 2.2
+     */
+    public OptimizationException(Localizable specifier, Object ... parts) {
         super(specifier, parts);
     }
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/DirectSearchOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/DirectSearchOptimizer.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/DirectSearchOptimizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/DirectSearchOptimizer.java Wed Jun 16 23:03:38 2010
@@ -31,6 +31,7 @@ import org.apache.commons.math.optimizat
 import org.apache.commons.math.optimization.RealConvergenceChecker;
 import org.apache.commons.math.optimization.RealPointValuePair;
 import org.apache.commons.math.optimization.SimpleScalarValueChecker;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * This class implements simplex-based direct search optimization
@@ -87,14 +88,6 @@ import org.apache.commons.math.optimizat
  */
 public abstract class DirectSearchOptimizer implements MultivariateRealOptimizer {
 
-    /** Message for equal vertices. */
-    private static final String EQUAL_VERTICES_MESSAGE =
-        "equal vertices {0} and {1} in simplex configuration";
-
-    /** Message for dimension mismatch. */
-    private static final String DIMENSION_MISMATCH_MESSAGE =
-        "dimension mismatch {0} != {1}";
-
     /** Simplex. */
     protected RealPointValuePair[] simplex;
 
@@ -154,7 +147,7 @@ public abstract class DirectSearchOptimi
             for (int j = 0; j < i + 1; ++j) {
                 if (steps[j] == 0.0) {
                     throw MathRuntimeException.createIllegalArgumentException(
-                          EQUAL_VERTICES_MESSAGE, j, j + 1);
+                          LocalizedFormats.EQUAL_VERTICES_IN_SIMPLEX, j, j + 1);
                 }
                 System.arraycopy(steps, 0, vertexI, 0, j + 1);
             }
@@ -178,7 +171,7 @@ public abstract class DirectSearchOptimi
         final int n = referenceSimplex.length - 1;
         if (n < 0) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "simplex must contain at least one point");
+                    LocalizedFormats.SIMPLEX_NEED_ONE_POINT);
         }
         startConfiguration = new double[n][n];
         final double[] ref0 = referenceSimplex[0];
@@ -191,7 +184,7 @@ public abstract class DirectSearchOptimi
             // safety checks
             if (refI.length != n) {
                 throw MathRuntimeException.createIllegalArgumentException(
-                      DIMENSION_MISMATCH_MESSAGE, refI.length, n);
+                      LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, refI.length, n);
             }
             for (int j = 0; j < i; ++j) {
                 final double[] refJ = referenceSimplex[j];
@@ -204,7 +197,7 @@ public abstract class DirectSearchOptimi
                 }
                 if (allEquals) {
                     throw MathRuntimeException.createIllegalArgumentException(
-                          EQUAL_VERTICES_MESSAGE, i, j);
+                          LocalizedFormats.EQUAL_VERTICES_IN_SIMPLEX, i, j);
                 }
             }
 
@@ -366,7 +359,7 @@ public abstract class DirectSearchOptimi
         final int n = startPoint.length;
         if (n != startConfiguration.length) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  DIMENSION_MISMATCH_MESSAGE, n, startConfiguration.length);
+                  LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, n, startConfiguration.length);
         }
 
         // set first vertex

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/HarmonicCoefficientsGuesser.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/HarmonicCoefficientsGuesser.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/HarmonicCoefficientsGuesser.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/HarmonicCoefficientsGuesser.java Wed Jun 16 23:03:38 2010
@@ -18,6 +18,7 @@
 package org.apache.commons.math.optimization.fitting;
 
 import org.apache.commons.math.optimization.OptimizationException;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /** This class guesses harmonic coefficients from a sample.
 
@@ -238,7 +239,7 @@ public class HarmonicCoefficientsGuesser
         double c2 = sxy * sxz - sx2 * syz;
         double c3 = sx2 * sy2 - sxy * sxy;
         if ((c1 / c2 < 0.0) || (c2 / c3 < 0.0)) {
-            throw new OptimizationException("unable to first guess the harmonic coefficients");
+            throw new OptimizationException(LocalizedFormats.UNABLE_TO_FIRST_GUESS_HARMONIC_COEFFICIENTS);
         }
         a     = Math.sqrt(c1 / c2);
         omega = Math.sqrt(c2 / c3);

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/HarmonicFitter.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/HarmonicFitter.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/HarmonicFitter.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/HarmonicFitter.java Wed Jun 16 23:03:38 2010
@@ -21,6 +21,7 @@ import org.apache.commons.math.FunctionE
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.optimization.DifferentiableMultivariateVectorialOptimizer;
 import org.apache.commons.math.optimization.OptimizationException;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /** This class implements a curve fitting specialized for sinusoids.
  * <p>Harmonic fitting is a very simple case of curve fitting. The
@@ -82,7 +83,7 @@ public class HarmonicFitter {
             if (parameters == null) {
                 final WeightedObservedPoint[] observations = fitter.getObservations();
                 if (observations.length < 4) {
-                    throw new OptimizationException("sample contains {0} observed points, at least {1} are required",
+                    throw new OptimizationException(LocalizedFormats.INSUFFICIENT_OBSERVED_POINTS_IN_SAMPLE,
                                                     observations.length, 4);
                 }
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractLeastSquaresOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractLeastSquaresOptimizer.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractLeastSquaresOptimizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractLeastSquaresOptimizer.java Wed Jun 16 23:03:38 2010
@@ -31,6 +31,7 @@ import org.apache.commons.math.optimizat
 import org.apache.commons.math.optimization.VectorialConvergenceChecker;
 import org.apache.commons.math.optimization.DifferentiableMultivariateVectorialOptimizer;
 import org.apache.commons.math.optimization.VectorialPointValuePair;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Base class for implementing least squares optimizers.
@@ -183,7 +184,7 @@ public abstract class AbstractLeastSquar
         ++jacobianEvaluations;
         jacobian = jF.value(point);
         if (jacobian.length != rows) {
-            throw new FunctionEvaluationException(point, "dimension mismatch {0} != {1}",
+            throw new FunctionEvaluationException(point, LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE,
                                                   jacobian.length, rows);
         }
         for (int i = 0; i < rows; i++) {
@@ -210,7 +211,7 @@ public abstract class AbstractLeastSquar
         }
         objective = function.value(point);
         if (objective.length != rows) {
-            throw new FunctionEvaluationException(point, "dimension mismatch {0} != {1}",
+            throw new FunctionEvaluationException(point, LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE,
                                                   objective.length, rows);
         }
         cost = 0;
@@ -290,7 +291,7 @@ public abstract class AbstractLeastSquar
                 new LUDecompositionImpl(MatrixUtils.createRealMatrix(jTj)).getSolver().getInverse();
             return inverse.getData();
         } catch (InvalidMatrixException ime) {
-            throw new OptimizationException("unable to compute covariances: singular problem");
+            throw new OptimizationException(LocalizedFormats.UNABLE_TO_COMPUTE_COVARIANCE_SINGULAR_PROBLEM);
         }
 
     }
@@ -308,7 +309,7 @@ public abstract class AbstractLeastSquar
         throws FunctionEvaluationException, OptimizationException {
         if (rows <= cols) {
             throw new OptimizationException(
-                    "no degrees of freedom ({0} measurements, {1} parameters)",
+                    LocalizedFormats.NO_DEGREES_OF_FREEDOM,
                     rows, cols);
         }
         double[] errors = new double[cols];
@@ -327,7 +328,7 @@ public abstract class AbstractLeastSquar
         throws FunctionEvaluationException, OptimizationException, IllegalArgumentException {
 
         if (target.length != weights.length) {
-            throw new OptimizationException("dimension mismatch {0} != {1}",
+            throw new OptimizationException(LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE,
                                             target.length, weights.length);
         }
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/GaussNewtonOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/GaussNewtonOptimizer.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/GaussNewtonOptimizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/GaussNewtonOptimizer.java Wed Jun 16 23:03:38 2010
@@ -26,6 +26,7 @@ import org.apache.commons.math.linear.QR
 import org.apache.commons.math.linear.RealMatrix;
 import org.apache.commons.math.optimization.OptimizationException;
 import org.apache.commons.math.optimization.VectorialPointValuePair;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Gauss-Newton least-squares solver.
@@ -116,7 +117,7 @@ public class GaussNewtonOptimizer extend
                 }
 
             } catch(InvalidMatrixException e) {
-                throw new OptimizationException("unable to solve: singular problem");
+                throw new OptimizationException(LocalizedFormats.UNABLE_TO_SOLVE_SINGULAR_PROBLEM);
             }
 
             // check convergence

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/LevenbergMarquardtOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/LevenbergMarquardtOptimizer.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/LevenbergMarquardtOptimizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/LevenbergMarquardtOptimizer.java Wed Jun 16 23:03:38 2010
@@ -21,6 +21,7 @@ import java.util.Arrays;
 import org.apache.commons.math.FunctionEvaluationException;
 import org.apache.commons.math.optimization.OptimizationException;
 import org.apache.commons.math.optimization.VectorialPointValuePair;
+import org.apache.commons.math.util.LocalizedFormats;
 import org.apache.commons.math.util.MathUtils;
 
 
@@ -451,18 +452,13 @@ public class LevenbergMarquardtOptimizer
                 // tests for termination and stringent tolerances
                 // (2.2204e-16 is the machine epsilon for IEEE754)
                 if ((Math.abs(actRed) <= 2.2204e-16) && (preRed <= 2.2204e-16) && (ratio <= 2.0)) {
-                    throw new OptimizationException("cost relative tolerance is too small ({0})," +
-                            " no further reduction in the" +
-                            " sum of squares is possible",
+                    throw new OptimizationException(LocalizedFormats.TOO_SMALL_COST_RELATIVE_TOLERANCE,
                             costRelativeTolerance);
                 } else if (delta <= 2.2204e-16 * xNorm) {
-                    throw new OptimizationException("parameters relative tolerance is too small" +
-                            " ({0}), no further improvement in" +
-                            " the approximate solution is possible",
+                    throw new OptimizationException(LocalizedFormats.TOO_SMALL_PARAMETERS_RELATIVE_TOLERANCE,
                             parRelativeTolerance);
                 } else if (maxCosine <= 2.2204e-16)  {
-                    throw new OptimizationException("orthogonality tolerance is too small ({0})," +
-                            " solution is orthogonal to the jacobian",
+                    throw new OptimizationException(LocalizedFormats.TOO_SMALL_ORTHOGONALITY_TOLERANCE,
                             orthoTolerance);
                 }
 
@@ -815,8 +811,7 @@ public class LevenbergMarquardtOptimizer
                     norm2 += aki * aki;
                 }
                 if (Double.isInfinite(norm2) || Double.isNaN(norm2)) {
-                    throw new OptimizationException(
-                            "unable to perform Q.R decomposition on the {0}x{1} jacobian matrix",
+                    throw new OptimizationException(LocalizedFormats.UNABLE_TO_PERFORM_QR_DECOMPOSITION_ON_JACOBIAN,
                             rows, cols);
                 }
                 if (norm2 > ak2) {

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizer.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizer.java Wed Jun 16 23:03:38 2010
@@ -26,6 +26,7 @@ import org.apache.commons.math.optimizat
 import org.apache.commons.math.optimization.OptimizationException;
 import org.apache.commons.math.optimization.DifferentiableMultivariateRealOptimizer;
 import org.apache.commons.math.optimization.RealPointValuePair;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Non-linear conjugate gradient optimizer.
@@ -233,7 +234,7 @@ public class NonLinearConjugateGradientO
                 return b;
             }
         }
-        throw new OptimizationException("unable to bracket optimum in line search");
+        throw new OptimizationException(LocalizedFormats.UNABLE_TO_BRACKET_OPTIMUM_IN_LINE_SEARCH);
     }
 
     /** Default identity preconditioner. */

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/NoFeasibleSolutionException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/NoFeasibleSolutionException.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/NoFeasibleSolutionException.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/NoFeasibleSolutionException.java Wed Jun 16 23:03:38 2010
@@ -18,6 +18,7 @@
 package org.apache.commons.math.optimization.linear;
 
 import org.apache.commons.math.optimization.OptimizationException;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * This class represents exceptions thrown by optimizers when no solution
@@ -34,7 +35,7 @@ public class NoFeasibleSolutionException
      * Simple constructor using a default message.
      */
     public NoFeasibleSolutionException() {
-        super("no feasible solution");
+        super(LocalizedFormats.NO_FEASIBLE_SOLUTION);
     }
 
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/UnboundedSolutionException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/UnboundedSolutionException.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/UnboundedSolutionException.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/UnboundedSolutionException.java Wed Jun 16 23:03:38 2010
@@ -18,6 +18,7 @@
 package org.apache.commons.math.optimization.linear;
 
 import org.apache.commons.math.optimization.OptimizationException;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * This class represents exceptions thrown by optimizers when a solution
@@ -34,7 +35,7 @@ public class UnboundedSolutionException 
      * Simple constructor using a default message.
      */
     public UnboundedSolutionException() {
-        super("unbounded solution");
+        super(LocalizedFormats.UNBOUNDED_SOLUTION);
     }
 
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/AbstractUnivariateRealOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/AbstractUnivariateRealOptimizer.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/AbstractUnivariateRealOptimizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/AbstractUnivariateRealOptimizer.java Wed Jun 16 23:03:38 2010
@@ -23,6 +23,7 @@ import org.apache.commons.math.MathRunti
 import org.apache.commons.math.MaxEvaluationsExceededException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
 import org.apache.commons.math.optimization.UnivariateRealOptimizer;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Provide a default implementation for several functions useful to generic
@@ -69,7 +70,7 @@ public abstract class AbstractUnivariate
      */
     protected void checkResultComputed() throws IllegalStateException {
         if (!resultComputed) {
-            throw MathRuntimeException.createIllegalStateException("no result available");
+            throw MathRuntimeException.createIllegalStateException(LocalizedFormats.NO_RESULT_AVAILABLE);
         }
     }
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/AbstractRandomGenerator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/AbstractRandomGenerator.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/AbstractRandomGenerator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/AbstractRandomGenerator.java Wed Jun 16 23:03:38 2010
@@ -17,6 +17,7 @@
 package org.apache.commons.math.random;
 
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Abstract class implementing the {@link  RandomGenerator} interface.
@@ -155,7 +156,7 @@ public abstract class AbstractRandomGene
     public int nextInt(int n) {
         if (n <= 0 ) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "upper bound must be positive ({0})", n);
+                  LocalizedFormats.NOT_POSITIVE_UPPER_BOUND, n);
         }
         int result = (int) (nextDouble() * n);
         return result < n ? result : n - 1;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/BitsStreamGenerator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/BitsStreamGenerator.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/BitsStreamGenerator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/BitsStreamGenerator.java Wed Jun 16 23:03:38 2010
@@ -17,6 +17,7 @@
 package org.apache.commons.math.random;
 
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /** Base class for random number generators that generates bits streams.
 
@@ -123,7 +124,7 @@ public abstract class BitsStreamGenerato
 
         if (n < 1) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "upper bound must be positive ({0})", n);
+                  LocalizedFormats.NOT_POSITIVE_UPPER_BOUND, n);
         }
 
         // find bit mask for n

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java Wed Jun 16 23:03:38 2010
@@ -30,6 +30,7 @@ import java.util.List;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.stat.descriptive.StatisticalSummary;
 import org.apache.commons.math.stat.descriptive.SummaryStatistics;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Implements <code>EmpiricalDistribution</code> interface.  This implementation
@@ -138,7 +139,7 @@ public class EmpiricalDistributionImpl i
             DataAdapter da = new StreamDataAdapter(in);
             da.computeStats();
             if (sampleStats.getN() == 0) {
-                throw MathRuntimeException.createEOFException("URL {0} contains no data",
+                throw MathRuntimeException.createEOFException(LocalizedFormats.URL_CONTAINS_NO_DATA,
                                                               url);
             }
             in = new BufferedReader(new InputStreamReader(url.openStream()));
@@ -370,7 +371,7 @@ public class EmpiricalDistributionImpl i
     public double getNextValue() throws IllegalStateException {
 
         if (!loaded) {
-            throw MathRuntimeException.createIllegalStateException("distribution not loaded");
+            throw MathRuntimeException.createIllegalStateException(LocalizedFormats.DISTRIBUTION_NOT_LOADED);
         }
 
         // Start with a uniformly distributed random number in (0,1)
@@ -390,7 +391,7 @@ public class EmpiricalDistributionImpl i
                }
            }
         }
-        throw new MathRuntimeException("no bin selected");
+        throw new MathRuntimeException(LocalizedFormats.NO_BIN_SELECTED);
     }
 
     /**



Mime
View raw message