commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject svn commit: r1044186 [2/4] - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/analysis/interpolation/ main/java/org/apache/commons/math/complex/ main/java/org/apache/commons/math/distribution/ main/java/org/apache/commons/math/excep...
Date Fri, 10 Dec 2010 00:50:52 GMT
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/MathUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/MathUtils.java?rev=1044186&r1=1044185&r2=1044186&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/MathUtils.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/MathUtils.java Fri Dec 10 00:50:50 2010
@@ -25,7 +25,6 @@ import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.Collections;
 
-import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.exception.util.Localizable;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.exception.NonMonotonousSequenceException;
@@ -34,6 +33,7 @@ import org.apache.commons.math.exception
 import org.apache.commons.math.exception.NotPositiveException;
 import org.apache.commons.math.exception.MathArithmeticException;
 import org.apache.commons.math.exception.MathIllegalArgumentException;
+import org.apache.commons.math.exception.MathRuntimeException;
 import org.apache.commons.math.exception.NumberIsTooLargeException;
 
 /**
@@ -103,7 +103,7 @@ public final class MathUtils {
      *
      * @param x an addend
      * @param y an addend
-     * @return the sum <code>x+y</code>
+     * @return the sum {@code x+y}
      * @throws MathArithmeticException if the result can not be represented
      * as an {@code int}.
      * @since 1.1
@@ -121,8 +121,8 @@ public final class MathUtils {
      *
      * @param a an addend
      * @param b an addend
-     * @return the sum <code>a+b</code>
-     * @throws ArithmeticException if the result can not be represented as an
+     * @return the sum {@code a+b}
+     * @throws MathArithmeticException if the result can not be represented as an
      *         long
      * @since 1.2
      */
@@ -179,27 +179,27 @@ public final class MathUtils {
     /**
      * Returns an exact representation of the <a
      * href="http://mathworld.wolfram.com/BinomialCoefficient.html"> Binomial
-     * Coefficient</a>, "<code>n choose k</code>", the number of
-     * <code>k</code>-element subsets that can be selected from an
-     * <code>n</code>-element set.
+     * Coefficient</a>, "{@code n choose k}", the number of
+     * {@code k}-element subsets that can be selected from an
+     * {@code n}-element set.
      * <p>
      * <Strong>Preconditions</strong>:
      * <ul>
-     * <li> <code>0 <= k <= n </code> (otherwise
-     * <code>IllegalArgumentException</code> is thrown)</li>
-     * <li> The result is small enough to fit into a <code>long</code>. The
-     * largest value of <code>n</code> for which all coefficients are
-     * <code> < Long.MAX_VALUE</code> is 66. If the computed value exceeds
-     * <code>Long.MAX_VALUE</code> an <code>ArithMeticException</code> is
+     * <li> {@code 0 <= k <= n } (otherwise
+     * {@code IllegalArgumentException} is thrown)</li>
+     * <li> The result is small enough to fit into a {@code long}. The
+     * largest value of {@code n} for which all coefficients are
+     * {@code  < Long.MAX_VALUE} is 66. If the computed value exceeds
+     * {@code Long.MAX_VALUE} an {@code ArithMeticException} is
      * thrown.</li>
      * </ul></p>
      *
      * @param n the size of the set
      * @param k the size of the subsets to be counted
-     * @return <code>n choose k</code>
-     * @throws IllegalArgumentException if preconditions are not met.
-     * @throws ArithmeticException if the result is too large to be represented
-     *         by a long integer.
+     * @return {@code n choose k}
+     * @throws MathIllegalArgumentException if preconditions are not met.
+     * @throws MathArithmeticException if the result is too large to be
+     * represented by a long integer.
      */
     public static long binomialCoefficient(final int n, final int k) {
         checkBinomial(n, k);
@@ -256,25 +256,25 @@ public final class MathUtils {
     }
 
     /**
-     * Returns a <code>double</code> representation of the <a
+     * Returns a {@code double} representation of the <a
      * href="http://mathworld.wolfram.com/BinomialCoefficient.html"> Binomial
-     * Coefficient</a>, "<code>n choose k</code>", the number of
-     * <code>k</code>-element subsets that can be selected from an
-     * <code>n</code>-element set.
+     * Coefficient</a>, "{@code n choose k}", the number of
+     * {@code k}-element subsets that can be selected from an
+     * {@code n}-element set.
      * <p>
      * <Strong>Preconditions</strong>:
      * <ul>
-     * <li> <code>0 <= k <= n </code> (otherwise
-     * <code>IllegalArgumentException</code> is thrown)</li>
-     * <li> The result is small enough to fit into a <code>double</code>. The
-     * largest value of <code>n</code> for which all coefficients are <
+     * <li> {@code 0 <= k <= n } (otherwise
+     * {@code IllegalArgumentException} is thrown)</li>
+     * <li> The result is small enough to fit into a {@code double}. The
+     * largest value of {@code n} for which all coefficients are <
      * Double.MAX_VALUE is 1029. If the computed value exceeds Double.MAX_VALUE,
      * Double.POSITIVE_INFINITY is returned</li>
      * </ul></p>
      *
      * @param n the size of the set
      * @param k the size of the subsets to be counted
-     * @return <code>n choose k</code>
+     * @return {@code n choose k}
      * @throws IllegalArgumentException if preconditions are not met.
      */
     public static double binomialCoefficientDouble(final int n, final int k) {
@@ -301,21 +301,21 @@ public final class MathUtils {
     }
 
     /**
-     * Returns the natural <code>log</code> of the <a
+     * Returns the natural {@code log} of the <a
      * href="http://mathworld.wolfram.com/BinomialCoefficient.html"> Binomial
-     * Coefficient</a>, "<code>n choose k</code>", the number of
-     * <code>k</code>-element subsets that can be selected from an
-     * <code>n</code>-element set.
+     * Coefficient</a>, "{@code n choose k}", the number of
+     * {@code k}-element subsets that can be selected from an
+     * {@code n}-element set.
      * <p>
      * <Strong>Preconditions</strong>:
      * <ul>
-     * <li> <code>0 <= k <= n </code> (otherwise
-     * <code>IllegalArgumentException</code> is thrown)</li>
+     * <li> {@code 0 <= k <= n } (otherwise
+     * {@code IllegalArgumentException} is thrown)</li>
      * </ul></p>
      *
      * @param n the size of the set
      * @param k the size of the subsets to be counted
-     * @return <code>n choose k</code>
+     * @return {@code n choose k}
      * @throws IllegalArgumentException if preconditions are not met.
      */
     public static double binomialCoefficientLog(final int n, final int k) {
@@ -568,23 +568,23 @@ public final class MathUtils {
     }
 
     /**
-     * Returns n!. Shorthand for <code>n</code> <a
+     * Returns n!. Shorthand for {@code n} <a
      * href="http://mathworld.wolfram.com/Factorial.html"> Factorial</a>, the
-     * product of the numbers <code>1,...,n</code>.
+     * product of the numbers {@code 1,...,n}.
      * <p>
      * <Strong>Preconditions</strong>:
      * <ul>
-     * <li> <code>n >= 0</code> (otherwise
-     * <code>IllegalArgumentException</code> is thrown)</li>
-     * <li> The result is small enough to fit into a <code>long</code>. The
-     * largest value of <code>n</code> for which <code>n!</code> <
-     * Long.MAX_VALUE</code> is 20. If the computed value exceeds <code>Long.MAX_VALUE</code>
-     * an <code>ArithMeticException </code> is thrown.</li>
+     * <li> {@code n >= 0} (otherwise
+     * {@code IllegalArgumentException} is thrown)</li>
+     * <li> The result is small enough to fit into a {@code long}. The
+     * largest value of {@code n} for which {@code n!} <
+     * Long.MAX_VALUE} is 20. If the computed value exceeds {@code Long.MAX_VALUE}
+     * an {@code ArithMeticException } is thrown.</li>
      * </ul>
      * </p>
      *
      * @param n argument
-     * @return <code>n!</code>
+     * @return {@code n!}
      * @throws MathArithmeticException if the result is too large to be represented
      * by a {@code long}.
      * @throws NotPositiveException if {@code n < 0}.
@@ -658,16 +658,16 @@ public final class MathUtils {
      * Special cases:
      * <ul>
      * <li>The invocations
-     * <code>gcd(Integer.MIN_VALUE, Integer.MIN_VALUE)</code>,
-     * <code>gcd(Integer.MIN_VALUE, 0)</code> and
-     * <code>gcd(0, Integer.MIN_VALUE)</code> throw an
-     * <code>ArithmeticException</code>, because the result would be 2^31, which
+     * {@code gcd(Integer.MIN_VALUE, Integer.MIN_VALUE)},
+     * {@code gcd(Integer.MIN_VALUE, 0)} and
+     * {@code gcd(0, Integer.MIN_VALUE)} throw an
+     * {@code ArithmeticException}, because the result would be 2^31, which
      * is too large for an int value.</li>
-     * <li>The result of <code>gcd(x, x)</code>, <code>gcd(0, x)</code> and
-     * <code>gcd(x, 0)</code> is the absolute value of <code>x</code>, except
+     * <li>The result of {@code gcd(x, x)}, {@code gcd(0, x)} and
+     * {@code gcd(x, 0)} is the absolute value of {@code x}, except
      * for the special cases above.
-     * <li>The invocation <code>gcd(0, 0)</code> is the only one which returns
-     * <code>0</code>.</li>
+     * <li>The invocation {@code gcd(0, 0)} is the only one which returns
+     * {@code 0}.</li>
      * </ul>
      *
      * @param p Number.
@@ -745,16 +745,16 @@ public final class MathUtils {
      * Special cases:
      * <ul>
      * <li>The invocations
-     * <code>gcd(Long.MIN_VALUE, Long.MIN_VALUE)</code>,
-     * <code>gcd(Long.MIN_VALUE, 0L)</code> and
-     * <code>gcd(0L, Long.MIN_VALUE)</code> throw an
-     * <code>ArithmeticException</code>, because the result would be 2^63, which
+     * {@code gcd(Long.MIN_VALUE, Long.MIN_VALUE)},
+     * {@code gcd(Long.MIN_VALUE, 0L)} and
+     * {@code gcd(0L, Long.MIN_VALUE)} throw an
+     * {@code ArithmeticException}, because the result would be 2^63, which
      * is too large for a long value.</li>
-     * <li>The result of <code>gcd(x, x)</code>, <code>gcd(0L, x)</code> and
-     * <code>gcd(x, 0L)</code> is the absolute value of <code>x</code>, except
+     * <li>The result of {@code gcd(x, x)}, {@code gcd(0L, x)} and
+     * {@code gcd(x, 0L)} is the absolute value of {@code x}, except
      * for the special cases above.
-     * <li>The invocation <code>gcd(0L, 0L)</code> is the only one which returns
-     * <code>0L</code>.</li>
+     * <li>The invocation {@code gcd(0L, 0L)} is the only one which returns
+     * {@code 0L}.</li>
      * </ul>
      *
      * @param p Number.
@@ -856,8 +856,8 @@ public final class MathUtils {
 
     /**
      * For a double precision value x, this method returns +1.0 if x >= 0 and
-     * -1.0 if x < 0. Returns <code>NaN</code> if <code>x</code> is
-     * <code>NaN</code>.
+     * -1.0 if x < 0. Returns {@code NaN} if {@code x} is
+     * {@code NaN}.
      *
      * @param x the value, a double
      * @return +1.0 or -1.0, depending on the sign of x
@@ -871,7 +871,7 @@ public final class MathUtils {
 
     /**
      * For a float value x, this method returns +1.0F if x >= 0 and -1.0F if x <
-     * 0. Returns <code>NaN</code> if <code>x</code> is <code>NaN</code>.
+     * 0. Returns {@code NaN} if {@code x} is {@code NaN}.
      *
      * @param x the value, a float
      * @return +1.0F or -1.0F, depending on the sign of x
@@ -917,16 +917,16 @@ public final class MathUtils {
     /**
      * <p>
      * Returns the least common multiple of the absolute value of two numbers,
-     * using the formula <code>lcm(a,b) = (a / gcd(a,b)) * b</code>.
+     * using the formula {@code lcm(a,b) = (a / gcd(a,b)) * b}.
      * </p>
      * Special cases:
      * <ul>
-     * <li>The invocations <code>lcm(Integer.MIN_VALUE, n)</code> and
-     * <code>lcm(n, Integer.MIN_VALUE)</code>, where <code>abs(n)</code> is a
-     * power of 2, throw an <code>ArithmeticException</code>, because the result
+     * <li>The invocations {@code lcm(Integer.MIN_VALUE, n)} and
+     * {@code lcm(n, Integer.MIN_VALUE)}, where {@code abs(n)} is a
+     * power of 2, throw an {@code ArithmeticException}, because the result
      * would be 2^31, which is too large for an int value.</li>
-     * <li>The result of <code>lcm(0, x)</code> and <code>lcm(x, 0)</code> is
-     * <code>0</code> for any <code>x</code>.
+     * <li>The result of {@code lcm(0, x)} and {@code lcm(x, 0)} is
+     * {@code 0} for any {@code x}.
      * </ul>
      *
      * @param a Number.
@@ -951,16 +951,16 @@ public final class MathUtils {
     /**
      * <p>
      * Returns the least common multiple of the absolute value of two numbers,
-     * using the formula <code>lcm(a,b) = (a / gcd(a,b)) * b</code>.
+     * using the formula {@code lcm(a,b) = (a / gcd(a,b)) * b}.
      * </p>
      * Special cases:
      * <ul>
-     * <li>The invocations <code>lcm(Long.MIN_VALUE, n)</code> and
-     * <code>lcm(n, Long.MIN_VALUE)</code>, where <code>abs(n)</code> is a
-     * power of 2, throw an <code>ArithmeticException</code>, because the result
+     * <li>The invocations {@code lcm(Long.MIN_VALUE, n)} and
+     * {@code lcm(n, Long.MIN_VALUE)}, where {@code abs(n)} is a
+     * power of 2, throw an {@code ArithmeticException}, because the result
      * would be 2^63, which is too large for an int value.</li>
-     * <li>The result of <code>lcm(0L, x)</code> and <code>lcm(x, 0L)</code> is
-     * <code>0L</code> for any <code>x</code>.
+     * <li>The result of {@code lcm(0L, x)} and {@code lcm(x, 0L)} is
+     * {@code 0L} for any {@code x}.
      * </ul>
      *
      * @param a Number.
@@ -985,13 +985,13 @@ public final class MathUtils {
     /**
      * <p>Returns the
      * <a href="http://mathworld.wolfram.com/Logarithm.html">logarithm</a>
-     * for base <code>b</code> of <code>x</code>.
+     * for base {@code b} of {@code x}.
      * </p>
-     * <p>Returns <code>NaN<code> if either argument is negative.  If
-     * <code>base</code> is 0 and <code>x</code> is positive, 0 is returned.
-     * If <code>base</code> is positive and <code>x</code> is 0,
-     * <code>Double.NEGATIVE_INFINITY</code> is returned.  If both arguments
-     * are 0, the result is <code>NaN</code>.</p>
+     * <p>Returns {@code NaN} if either argument is negative. If
+     * {@code base} is 0 and {@code x} is positive, 0 is returned.
+     * If {@code base} is positive and {@code x} is 0,
+     * {@code Double.NEGATIVE_INFINITY} is returned.  If both arguments
+     * are 0, the result is {@code NaN}.</p>
      *
      * @param base the base of the logarithm, must be greater than 0
      * @param x argument, must be greater than 0
@@ -1076,7 +1076,7 @@ public final class MathUtils {
 
     /**
      * Scale a number by 2<sup>scaleFactor</sup>.
-     * <p>If <code>d</code> is 0 or NaN or Infinite, it is returned unchanged.</p>
+     * <p>If {@code d} is 0 or NaN or Infinite, it is returned unchanged.</p>
      *
      * @param d base number
      * @param scaleFactor power of two by which d sould be multiplied
@@ -1106,11 +1106,11 @@ public final class MathUtils {
      * <p>This method has three main uses:</p>
      * <ul>
      *   <li>normalize an angle between 0 and 2&pi;:<br/>
-     *       <code>a = MathUtils.normalizeAngle(a, FastMath.PI);</code></li>
+     *       {@code a = MathUtils.normalizeAngle(a, FastMath.PI);}</li>
      *   <li>normalize an angle between -&pi; and +&pi;<br/>
-     *       <code>a = MathUtils.normalizeAngle(a, 0.0);</code></li>
+     *       {@code a = MathUtils.normalizeAngle(a, 0.0);}</li>
      *   <li>compute the angle between two defining angular positions:<br>
-     *       <code>angle = MathUtils.normalizeAngle(end, start) - start;</code></li>
+     *       {@code angle = MathUtils.normalizeAngle(end, start) - start;}</li>
      * </ul>
      * <p>Note that due to numerical accuracy and since &pi; cannot be represented
      * exactly, the result interval is <em>closed</em>, it cannot be half-closed
@@ -1132,7 +1132,7 @@ public final class MathUtils {
       * applied to each non-NaN element x of the input array, where sum is the
       * sum of the non-NaN entries in the input array.</p>
       *
-      * <p>Throws IllegalArgumentException if <code>normalizedSum</code> is infinite
+      * <p>Throws IllegalArgumentException if {@code normalizedSum} is infinite
       * or NaN and ArithmeticException if the input array contains any infinite elements
       * or sums to 0</p>
       *
@@ -1141,33 +1141,30 @@ public final class MathUtils {
       * @param values input array to be normalized
       * @param normalizedSum target sum for the normalized array
       * @return normalized array
-      * @throws ArithmeticException if the input array contains infinite elements or sums to zero
-      * @throws IllegalArgumentException if the target sum is infinite or NaN
+      * @throws MathArithmeticException if the input array contains infinite elements or sums to zero
+      * @throws MathIllegalArgumentException if the target sum is infinite or NaN
       * @since 2.1
       */
      public static double[] normalizeArray(double[] values, double normalizedSum) {
          if (Double.isInfinite(normalizedSum)) {
-             throw MathRuntimeException.createIllegalArgumentException(
-                     LocalizedFormats.NORMALIZE_INFINITE);
+             throw new MathIllegalArgumentException(LocalizedFormats.NORMALIZE_INFINITE);
          }
          if (Double.isNaN(normalizedSum)) {
-             throw MathRuntimeException.createIllegalArgumentException(
-                     LocalizedFormats.NORMALIZE_NAN);
+             throw new MathIllegalArgumentException(LocalizedFormats.NORMALIZE_NAN);
          }
          double sum = 0d;
          final int len = values.length;
          double[] out = new double[len];
          for (int i = 0; i < len; i++) {
              if (Double.isInfinite(values[i])) {
-                 throw MathRuntimeException.createArithmeticException(
-                         LocalizedFormats.INFINITE_ARRAY_ELEMENT, values[i], i);
+                 throw new MathIllegalArgumentException(LocalizedFormats.INFINITE_ARRAY_ELEMENT, values[i], i);
              }
              if (!Double.isNaN(values[i])) {
                  sum += values[i];
              }
          }
          if (sum == 0) {
-             throw MathRuntimeException.createArithmeticException(LocalizedFormats.ARRAY_SUMS_TO_ZERO);
+             throw new MathArithmeticException(LocalizedFormats.ARRAY_SUMS_TO_ZERO);
          }
          for (int i = 0; i < len; i++) {
              if (Double.isNaN(values[i])) {
@@ -1216,6 +1213,8 @@ public final class MathUtils {
             } else {
                 return Double.NaN;
             }
+        } catch (RuntimeException ex) {
+            throw new MathRuntimeException(ex);
         }
     }
 
@@ -1344,7 +1343,7 @@ public final class MathUtils {
 
     /**
      * Returns the <a href="http://mathworld.wolfram.com/Sign.html"> sign</a>
-     * for byte value <code>x</code>.
+     * for byte value {@code x}.
      * <p>
      * For a byte value x, this method returns (byte)(+1) if x > 0, (byte)(0) if
      * x = 0, and (byte)(-1) if x < 0.</p>
@@ -1358,12 +1357,12 @@ public final class MathUtils {
 
     /**
      * Returns the <a href="http://mathworld.wolfram.com/Sign.html"> sign</a>
-     * for double precision <code>x</code>.
+     * for double precision {@code x}.
      * <p>
-     * For a double value <code>x</code>, this method returns
-     * <code>+1.0</code> if <code>x > 0</code>, <code>0.0</code> if
-     * <code>x = 0.0</code>, and <code>-1.0</code> if <code>x < 0</code>.
-     * Returns <code>NaN</code> if <code>x</code> is <code>NaN</code>.</p>
+     * For a double value {@code x}, this method returns
+     * {@code +1.0} if {@code x > 0}, {@code 0.0} if
+     * {@code x = 0.0}, and {@code -1.0} if {@code x < 0}.
+     * Returns {@code NaN} if {@code x} is {@code NaN}.</p>
      *
      * @param x the value, a double
      * @return +1.0, 0.0, or -1.0, depending on the sign of x
@@ -1377,11 +1376,11 @@ public final class MathUtils {
 
     /**
      * Returns the <a href="http://mathworld.wolfram.com/Sign.html"> sign</a>
-     * for float value <code>x</code>.
+     * for float value {@code x}.
      * <p>
      * For a float value x, this method returns +1.0F if x > 0, 0.0F if x =
-     * 0.0F, and -1.0F if x < 0. Returns <code>NaN</code> if <code>x</code>
-     * is <code>NaN</code>.</p>
+     * 0.0F, and -1.0F if x < 0. Returns {@code NaN} if {@code x}
+     * is {@code NaN}.</p>
      *
      * @param x the value, a float
      * @return +1.0F, 0.0F, or -1.0F, depending on the sign of x
@@ -1395,7 +1394,7 @@ public final class MathUtils {
 
     /**
      * Returns the <a href="http://mathworld.wolfram.com/Sign.html"> sign</a>
-     * for int value <code>x</code>.
+     * for int value {@code x}.
      * <p>
      * For an int value x, this method returns +1 if x > 0, 0 if x = 0, and -1
      * if x < 0.</p>
@@ -1409,7 +1408,7 @@ public final class MathUtils {
 
     /**
      * Returns the <a href="http://mathworld.wolfram.com/Sign.html"> sign</a>
-     * for long value <code>x</code>.
+     * for long value {@code x}.
      * <p>
      * For a long value x, this method returns +1L if x > 0, 0L if x = 0, and
      * -1L if x < 0.</p>
@@ -1478,7 +1477,7 @@ public final class MathUtils {
             if (a < 0) {
                 ret = a - b;
             } else {
-                throw new ArithmeticException(msg);
+                throw new MathArithmeticException(msg);
             }
         } else {
             // use additive inverse
@@ -1870,8 +1869,8 @@ public final class MathUtils {
      *     with the distribution.</li>
      * <li>The end-user documentation included with the redistribution, if any,
      *     must include the following acknowledgment:
-     *     <code>This product includes software developed by the University of
-     *           Chicago, as Operator of Argonne National Laboratory.</code>
+     *     {@code This product includes software developed by the University of
+     *           Chicago, as Operator of Argonne National Laboratory.}
      *     Alternately, this acknowledgment may appear in the software itself,
      *     if and wherever such third-party acknowledgments normally appear.</li>
      * <li><strong>WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS"

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=1044186&r1=1044185&r2=1044186&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 Fri Dec 10 00:50:50 2010
@@ -276,6 +276,8 @@ UNPARSEABLE_FRACTION_NUMBER = nombre fra
 UNPARSEABLE_REAL_VECTOR = vecteur r\u00e9el non analysable : "{0}"
 UNSUPPORTED_EXPANSION_MODE = mode d''extension {0} non support\u00e9, les modes support\u00e9s sont {1} ({2}) et {3} ({4})
 UNSUPPORTED_OPERATION = op\u00e9ration non disponible
+ARITHMETIC_EXCEPTION = erreur arithm\u00e9tique
+ILLEGAL_STATE = \u00e9tat incoh\u00e9rent
 USER_EXCEPTION = erreur g\u00e9n\u00e9r\u00e9e par le code utilisateur
 URL_CONTAINS_NO_DATA = l''adresse {0} ne contient aucune donn\u00e9e
 VALUES_ADDED_BEFORE_CONFIGURING_STATISTIC = {0} valeurs ont \u00e9t\u00e9 ajout\u00e9es 

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=1044186&r1=1044185&r2=1044186&view=diff
==============================================================================
--- commons/proper/math/trunk/src/site/xdoc/changes.xml (original)
+++ commons/proper/math/trunk/src/site/xdoc/changes.xml Fri Dec 10 00:50:50 2010
@@ -52,6 +52,10 @@ 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="fix" issue="MATH-447">
+        By policy, all Commons-Math exceptions must inherit from class
+        "MathRuntimeException".
+      </action>
       <action dev="erans" type="fix" issue="MATH-454">
         For optimizers (package "optimization"), the number of allowed function
         evaluations is passed as a parameter to the "optimize" method.

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/interpolation/BicubicSplineInterpolatingFunctionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/interpolation/BicubicSplineInterpolatingFunctionTest.java?rev=1044186&r1=1044185&r2=1044186&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/interpolation/BicubicSplineInterpolatingFunctionTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/interpolation/BicubicSplineInterpolatingFunctionTest.java Fri Dec 10 00:50:50 2010
@@ -17,7 +17,8 @@
 package org.apache.commons.math.analysis.interpolation;
 
 import org.apache.commons.math.MathException;
-import org.apache.commons.math.DimensionMismatchException;
+import org.apache.commons.math.exception.DimensionMismatchException;
+import org.apache.commons.math.exception.MathIllegalArgumentException;
 import org.apache.commons.math.analysis.BivariateRealFunction;
 import org.junit.Assert;
 import org.junit.Test;
@@ -45,14 +46,14 @@ public final class BicubicSplineInterpol
         try {
             bcf = new BicubicSplineInterpolatingFunction(wxval, yval, zval, zval, zval, zval);
             Assert.fail("an exception should have been thrown");
-        } catch (IllegalArgumentException e) {
+        } catch (MathIllegalArgumentException e) {
             // Expected
         }
         double[] wyval = new double[] {-4, -1, -1, 2.5};
         try {
             bcf = new BicubicSplineInterpolatingFunction(xval, wyval, zval, zval, zval, zval);
             Assert.fail("an exception should have been thrown");
-        } catch (IllegalArgumentException e) {
+        } catch (MathIllegalArgumentException e) {
             // Expected
         }
         double[][] wzval = new double[xval.length][yval.length - 1];

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/interpolation/BicubicSplineInterpolatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/interpolation/BicubicSplineInterpolatorTest.java?rev=1044186&r1=1044185&r2=1044186&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/interpolation/BicubicSplineInterpolatorTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/interpolation/BicubicSplineInterpolatorTest.java Fri Dec 10 00:50:50 2010
@@ -17,7 +17,8 @@
 package org.apache.commons.math.analysis.interpolation;
 
 import org.apache.commons.math.MathException;
-import org.apache.commons.math.DimensionMismatchException;
+import org.apache.commons.math.exception.DimensionMismatchException;
+import org.apache.commons.math.exception.MathIllegalArgumentException;
 import org.apache.commons.math.analysis.BivariateRealFunction;
 import org.junit.Assert;
 import org.junit.Test;
@@ -46,7 +47,7 @@ public final class BicubicSplineInterpol
         try {
             p = interpolator.interpolate(wxval, yval, zval);
             Assert.fail("an exception should have been thrown");
-        } catch (IllegalArgumentException e) {
+        } catch (MathIllegalArgumentException e) {
             // Expected
         }
 
@@ -54,7 +55,7 @@ public final class BicubicSplineInterpol
         try {
             p = interpolator.interpolate(xval, wyval, zval);
             Assert.fail("an exception should have been thrown");
-        } catch (IllegalArgumentException e) {
+        } catch (MathIllegalArgumentException e) {
             // Expected
         }
 

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolatorTest.java?rev=1044186&r1=1044185&r2=1044186&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolatorTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolatorTest.java Fri Dec 10 00:50:50 2010
@@ -18,6 +18,7 @@ package org.apache.commons.math.analysis
 
 import org.apache.commons.math.MathException;
 import org.apache.commons.math.exception.DimensionMismatchException;
+import org.apache.commons.math.exception.MathIllegalArgumentException;
 import org.apache.commons.math.util.FastMath;
 import org.apache.commons.math.analysis.BivariateRealFunction;
 import org.junit.Assert;
@@ -47,7 +48,7 @@ public final class SmoothingPolynomialBi
         try {
             p = interpolator.interpolate(wxval, yval, zval);
             Assert.fail("an exception should have been thrown");
-        } catch (IllegalArgumentException e) {
+        } catch (MathIllegalArgumentException e) {
             // Expected
         }
 
@@ -55,7 +56,7 @@ public final class SmoothingPolynomialBi
         try {
             p = interpolator.interpolate(xval, wyval, zval);
             Assert.fail("an exception should have been thrown");
-        } catch (IllegalArgumentException e) {
+        } catch (MathIllegalArgumentException e) {
             // Expected
         }
 

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/interpolation/TricubicSplineInterpolatingFunctionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/interpolation/TricubicSplineInterpolatingFunctionTest.java?rev=1044186&r1=1044185&r2=1044186&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/interpolation/TricubicSplineInterpolatingFunctionTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/interpolation/TricubicSplineInterpolatingFunctionTest.java Fri Dec 10 00:50:50 2010
@@ -17,6 +17,7 @@
 package org.apache.commons.math.analysis.interpolation;
 
 import org.apache.commons.math.exception.DimensionMismatchException;
+import org.apache.commons.math.exception.MathIllegalArgumentException;
 import org.apache.commons.math.util.FastMath;
 import org.apache.commons.math.analysis.TrivariateRealFunction;
 import org.junit.Assert;
@@ -49,7 +50,7 @@ public final class TricubicSplineInterpo
                                                           fval, fval, fval, fval,
                                                           fval, fval, fval, fval);
             Assert.fail("an exception should have been thrown");
-        } catch (IllegalArgumentException e) {
+        } catch (MathIllegalArgumentException e) {
             // Expected
         }
         double[] wyval = new double[] {-4, -1, -1, 2.5};
@@ -58,7 +59,7 @@ public final class TricubicSplineInterpo
                                                           fval, fval, fval, fval,
                                                           fval, fval, fval, fval);
             Assert.fail("an exception should have been thrown");
-        } catch (IllegalArgumentException e) {
+        } catch (MathIllegalArgumentException e) {
             // Expected
         }
         double[] wzval = new double[] {-12, -8, -9, -3, 0, 2.5};
@@ -67,7 +68,7 @@ public final class TricubicSplineInterpo
                                                           fval, fval, fval, fval,
                                                           fval, fval, fval, fval);
             Assert.fail("an exception should have been thrown");
-        } catch (IllegalArgumentException e) {
+        } catch (MathIllegalArgumentException e) {
             // Expected
         }
         double[][][] wfval = new double[xval.length - 1][yval.length - 1][zval.length];

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/interpolation/TricubicSplineInterpolatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/interpolation/TricubicSplineInterpolatorTest.java?rev=1044186&r1=1044185&r2=1044186&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/interpolation/TricubicSplineInterpolatorTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/interpolation/TricubicSplineInterpolatorTest.java Fri Dec 10 00:50:50 2010
@@ -18,6 +18,7 @@ package org.apache.commons.math.analysis
 
 import org.apache.commons.math.MathException;
 import org.apache.commons.math.exception.DimensionMismatchException;
+import org.apache.commons.math.exception.MathIllegalArgumentException;
 import org.apache.commons.math.util.FastMath;
 import org.apache.commons.math.analysis.TrivariateRealFunction;
 import org.junit.Assert;
@@ -48,7 +49,7 @@ public final class TricubicSplineInterpo
         try {
             p = interpolator.interpolate(wxval, yval, zval, fval);
             Assert.fail("an exception should have been thrown");
-        } catch (IllegalArgumentException e) {
+        } catch (MathIllegalArgumentException e) {
             // Expected
         }
 
@@ -56,7 +57,7 @@ public final class TricubicSplineInterpo
         try {
             p = interpolator.interpolate(xval, wyval, zval, fval);
             Assert.fail("an exception should have been thrown");
-        } catch (IllegalArgumentException e) {
+        } catch (MathIllegalArgumentException e) {
             // Expected
         }
 
@@ -64,7 +65,7 @@ public final class TricubicSplineInterpo
         try {
             p = interpolator.interpolate(xval, yval, wzval, fval);
             Assert.fail("an exception should have been thrown");
-        } catch (IllegalArgumentException e) {
+        } catch (MathIllegalArgumentException e) {
             // Expected
         }
 

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionLagrangeFormTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionLagrangeFormTest.java?rev=1044186&r1=1044185&r2=1044186&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionLagrangeFormTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionLagrangeFormTest.java Fri Dec 10 00:50:50 2010
@@ -17,6 +17,7 @@
 package org.apache.commons.math.analysis.polynomials;
 
 import junit.framework.TestCase;
+import org.apache.commons.math.exception.MathIllegalArgumentException;
 
 /**
  * Testcase for Lagrange form of polynomial function.
@@ -131,8 +132,8 @@ public final class PolynomialFunctionLag
             double x[] = { 1.0 };
             double y[] = { 2.0 };
             new PolynomialFunctionLagrangeForm(x, y);
-            fail("Expecting IllegalArgumentException - bad input array length");
-        } catch (IllegalArgumentException ex) {
+            fail("Expecting MathIllegalArgumentException - bad input array length");
+        } catch (MathIllegalArgumentException ex) {
             // expected
         }
         try {
@@ -140,8 +141,8 @@ public final class PolynomialFunctionLag
             double x[] = { 1.0, 2.0, 3.0, 4.0 };
             double y[] = { 0.0, -4.0, -24.0 };
             new PolynomialFunctionLagrangeForm(x, y);
-            fail("Expecting IllegalArgumentException - mismatch input arrays");
-        } catch (IllegalArgumentException ex) {
+            fail("Expecting MathIllegalArgumentException - mismatch input arrays");
+        } catch (MathIllegalArgumentException ex) {
             // expected
         }
     }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionNewtonFormTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionNewtonFormTest.java?rev=1044186&r1=1044185&r2=1044186&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionNewtonFormTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionNewtonFormTest.java Fri Dec 10 00:50:50 2010
@@ -16,6 +16,8 @@
  */
 package org.apache.commons.math.analysis.polynomials;
 
+import org.apache.commons.math.exception.MathIllegalArgumentException;
+
 import junit.framework.TestCase;
 
 /**
@@ -130,8 +132,8 @@ public final class PolynomialFunctionNew
             double a[] = { 1.0 };
             double c[] = { 2.0 };
             new PolynomialFunctionNewtonForm(a, c);
-            fail("Expecting IllegalArgumentException - bad input array length");
-        } catch (IllegalArgumentException ex) {
+            fail("Expecting MathIllegalArgumentException - bad input array length");
+        } catch (MathIllegalArgumentException ex) {
             // expected
         }
         try {
@@ -139,8 +141,8 @@ public final class PolynomialFunctionNew
             double a[] = { 1.0, 2.0, 3.0, 4.0 };
             double c[] = { 4.0, 3.0, 2.0, 1.0 };
             new PolynomialFunctionNewtonForm(a, c);
-            fail("Expecting IllegalArgumentException - mismatch input arrays");
-        } catch (IllegalArgumentException ex) {
+            fail("Expecting MathIllegalArgumentException - mismatch input arrays");
+        } catch (MathIllegalArgumentException ex) {
             // expected
         }
     }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/polynomials/PolynomialSplineFunctionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/polynomials/PolynomialSplineFunctionTest.java?rev=1044186&r1=1044185&r2=1044186&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/polynomials/PolynomialSplineFunctionTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/polynomials/PolynomialSplineFunctionTest.java Fri Dec 10 00:50:50 2010
@@ -21,6 +21,8 @@ import junit.framework.TestCase;
 
 import org.apache.commons.math.exception.OutOfRangeException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
+import org.apache.commons.math.exception.MathIllegalArgumentException;
+import org.apache.commons.math.exception.MathIllegalStateException;
 
 /**
  * Tests the PolynomialSplineFunction implementation.
@@ -65,22 +67,22 @@ public class PolynomialSplineFunctionTes
 
         try { // too few knots
             new PolynomialSplineFunction(new double[] {0}, polynomials);
-            fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+            fail("Expecting MathIllegalArgumentException");
+        } catch (MathIllegalArgumentException ex) {
             // expected
         }
 
         try { // too many knots
             new PolynomialSplineFunction(new double[] {0,1,2,3,4}, polynomials);
-            fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+            fail("Expecting MathIllegalArgumentException");
+        } catch (MathIllegalArgumentException ex) {
             // expected
         }
 
         try { // knots not increasing
             new PolynomialSplineFunction(new double[] {0,1, 3, 2}, polynomials);
-            fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+            fail("Expecting MathIllegalArgumentException");
+        } catch (MathIllegalArgumentException ex) {
             // expected
         }
     }
@@ -135,14 +137,14 @@ public class PolynomialSplineFunctionTes
      */
      protected int findKnot(double[] knots, double x) {
          if (x < knots[0] || x >= knots[knots.length -1]) {
-             throw new IllegalArgumentException("x is out of range");
+             throw new OutOfRangeException(x, knots[0], knots[knots.length -1]);
          }
          for (int i = 0; i < knots.length; i++) {
              if (knots[i] > x) {
-                 return i -1;
+                 return i - 1;
              }
          }
-         throw new IllegalArgumentException("x is out of range");
+         throw new MathIllegalStateException();
      }
 }
 

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtilsTest.java?rev=1044186&r1=1044185&r2=1044186&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtilsTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtilsTest.java Fri Dec 10 00:50:50 2010
@@ -17,6 +17,7 @@
 
 package org.apache.commons.math.analysis.solvers;
 
+import org.apache.commons.math.exception.MathIllegalArgumentException;
 import org.apache.commons.math.analysis.SinFunction;
 import org.apache.commons.math.analysis.QuinticFunction;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
@@ -36,7 +37,7 @@ public class UnivariateRealSolverUtilsTe
         try {
             UnivariateRealSolverUtils.solve(null, 0.0, 4.0);
             Assert.fail();
-        } catch(IllegalArgumentException ex){
+        } catch(MathIllegalArgumentException ex){
             // success
         }
     }
@@ -46,8 +47,8 @@ public class UnivariateRealSolverUtilsTe
         try { // bad endpoints
             double root = UnivariateRealSolverUtils.solve(sin, 4.0, -0.1, 1e-6);
             System.out.println("root=" + root);
-            Assert.fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+            Assert.fail("Expecting MathIllegalArgumentException");
+        } catch (MathIllegalArgumentException ex) {
             // expected
         }
     }
@@ -56,8 +57,8 @@ public class UnivariateRealSolverUtilsTe
     public void testSolveBadAccuracy() {
         try { // bad accuracy
             UnivariateRealSolverUtils.solve(sin, 0.0, 4.0, 0.0);
-//             Assert.fail("Expecting IllegalArgumentException"); // TODO needs rework since convergence behaviour was changed
-        } catch (IllegalArgumentException ex) {
+//             Assert.fail("Expecting MathIllegalArgumentException"); // TODO needs rework since convergence behaviour was changed
+        } catch (MathIllegalArgumentException ex) {
             // expected
         }
     }
@@ -74,7 +75,7 @@ public class UnivariateRealSolverUtilsTe
             double accuracy = 1.0e-6;
             UnivariateRealSolverUtils.solve(null, 0.0, 4.0, accuracy);
             Assert.fail();
-        } catch(IllegalArgumentException ex){
+        } catch(MathIllegalArgumentException ex){
             // success
         }
     }
@@ -91,8 +92,8 @@ public class UnivariateRealSolverUtilsTe
     public void testSolveNoRoot() {
         try {
             UnivariateRealSolverUtils.solve(sin, 1.0, 1.5);
-            Assert.fail("Expecting IllegalArgumentException ");
-        } catch (IllegalArgumentException ex) {
+            Assert.fail("Expecting MathIllegalArgumentException ");
+        } catch (MathIllegalArgumentException ex) {
             // expected
         }
     }
@@ -116,8 +117,8 @@ public class UnivariateRealSolverUtilsTe
     public void testNullFunction() {
         try { // null function
             UnivariateRealSolverUtils.bracket(null, 1.5, 0, 2.0);
-            Assert.fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+            Assert.fail("Expecting MathIllegalArgumentException");
+        } catch (MathIllegalArgumentException ex) {
             // expected
         }
     }
@@ -126,8 +127,8 @@ public class UnivariateRealSolverUtilsTe
     public void testBadInitial() {
         try { // initial not between endpoints
             UnivariateRealSolverUtils.bracket(sin, 2.5, 0, 2.0);
-            Assert.fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+            Assert.fail("Expecting MathIllegalArgumentException");
+        } catch (MathIllegalArgumentException ex) {
             // expected
         }
     }
@@ -136,8 +137,8 @@ public class UnivariateRealSolverUtilsTe
     public void testBadEndpoints() {
         try { // endpoints not valid
             UnivariateRealSolverUtils.bracket(sin, 1.5, 2.0, 1.0);
-            Assert.fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+            Assert.fail("Expecting MathIllegalArgumentException");
+        } catch (MathIllegalArgumentException ex) {
             // expected
         }
     }
@@ -146,8 +147,8 @@ public class UnivariateRealSolverUtilsTe
     public void testBadMaximumIterations() {
         try { // bad maximum iterations
             UnivariateRealSolverUtils.bracket(sin, 1.5, 0, 2.0, 0);
-            Assert.fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+            Assert.fail("Expecting MathIllegalArgumentException");
+        } catch (MathIllegalArgumentException ex) {
             // expected
         }
     }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexFormatAbstractTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexFormatAbstractTest.java?rev=1044186&r1=1044185&r2=1044186&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexFormatAbstractTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexFormatAbstractTest.java Fri Dec 10 00:50:50 2010
@@ -24,6 +24,8 @@ import java.util.Locale;
 
 import org.apache.commons.math.util.CompositeFormat;
 import org.apache.commons.math.util.FastMath;
+import org.apache.commons.math.exception.MathIllegalArgumentException;
+import org.apache.commons.math.exception.NullArgumentException;
 
 import junit.framework.TestCase;
 
@@ -292,7 +294,7 @@ public abstract class ComplexFormatAbstr
             ComplexFormat cf = new ComplexFormat();
             cf.setImaginaryFormat(null);
             fail();
-        } catch (IllegalArgumentException ex) {
+        } catch (NullArgumentException ex) {
             // success
         }
     }
@@ -302,7 +304,7 @@ public abstract class ComplexFormatAbstr
             ComplexFormat cf = new ComplexFormat();
             cf.setRealFormat(null);
             fail();
-        } catch (IllegalArgumentException ex) {
+        } catch (NullArgumentException ex) {
             // success
         }
     }
@@ -321,7 +323,7 @@ public abstract class ComplexFormatAbstr
             ComplexFormat cf = new ComplexFormat();
             cf.setImaginaryCharacter(null);
             fail();
-        } catch (IllegalArgumentException ex) {
+        } catch (NullArgumentException ex) {
             // success
         }
     }
@@ -331,7 +333,7 @@ public abstract class ComplexFormatAbstr
             ComplexFormat cf = new ComplexFormat();
             cf.setImaginaryCharacter("");
             fail();
-        } catch (IllegalArgumentException ex) {
+        } catch (MathIllegalArgumentException ex) {
             // success
         }
     }
@@ -349,7 +351,7 @@ public abstract class ComplexFormatAbstr
             Object object = new Object();
             cf.format(object);
             fail();
-        } catch (IllegalArgumentException ex) {
+        } catch (MathIllegalArgumentException ex) {
             // success
         }
     }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/ContinuousDistributionAbstractTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/ContinuousDistributionAbstractTest.java?rev=1044186&r1=1044185&r2=1044186&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/ContinuousDistributionAbstractTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/ContinuousDistributionAbstractTest.java Fri Dec 10 00:50:50 2010
@@ -20,6 +20,7 @@ import junit.framework.TestCase;
 
 import org.apache.commons.math.TestUtils;
 import org.apache.commons.math.util.FastMath;
+import org.apache.commons.math.exception.MathIllegalArgumentException;
 
 /**
  * Abstract base class for {@link ContinuousDistribution} tests.
@@ -240,20 +241,20 @@ public abstract class ContinuousDistribu
     public void testIllegalArguments() throws Exception {
         try {
             distribution.cumulativeProbability(1, 0);
-            fail("Expecting IllegalArgumentException for bad cumulativeProbability interval");
-        } catch (IllegalArgumentException ex) {
+            fail("Expecting MathIllegalArgumentException for bad cumulativeProbability interval");
+        } catch (MathIllegalArgumentException ex) {
             // expected
         }
         try {
             distribution.inverseCumulativeProbability(-1);
-            fail("Expecting IllegalArgumentException for p = -1");
-        } catch (IllegalArgumentException ex) {
+            fail("Expecting MathIllegalArgumentException for p = -1");
+        } catch (MathIllegalArgumentException ex) {
             // expected
         }
         try {
             distribution.inverseCumulativeProbability(2);
-            fail("Expecting IllegalArgumentException for p = 2");
-        } catch (IllegalArgumentException ex) {
+            fail("Expecting MathIllegalArgumentException for p = 2");
+        } catch (MathIllegalArgumentException ex) {
             // expected
         }
     }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/IntegerDistributionAbstractTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/IntegerDistributionAbstractTest.java?rev=1044186&r1=1044185&r2=1044186&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/IntegerDistributionAbstractTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/IntegerDistributionAbstractTest.java Fri Dec 10 00:50:50 2010
@@ -18,6 +18,7 @@ package org.apache.commons.math.distribu
 
 import org.apache.commons.math.TestUtils;
 import org.apache.commons.math.util.FastMath;
+import org.apache.commons.math.exception.MathIllegalArgumentException;
 
 import junit.framework.TestCase;
 
@@ -255,20 +256,20 @@ public abstract class IntegerDistributio
     public void testIllegalArguments() throws Exception {
         try {
             distribution.cumulativeProbability(1, 0);
-            fail("Expecting IllegalArgumentException for bad cumulativeProbability interval");
-        } catch (IllegalArgumentException ex) {
+            fail("Expecting MathIllegalArgumentException for bad cumulativeProbability interval");
+        } catch (MathIllegalArgumentException ex) {
             // expected
         }
         try {
             distribution.inverseCumulativeProbability(-1);
-            fail("Expecting IllegalArgumentException for p = -1");
-        } catch (IllegalArgumentException ex) {
+            fail("Expecting MathIllegalArgumentException for p = -1");
+        } catch (MathIllegalArgumentException ex) {
             // expected
         }
         try {
             distribution.inverseCumulativeProbability(2);
-            fail("Expecting IllegalArgumentException for p = 2");
-        } catch (IllegalArgumentException ex) {
+            fail("Expecting MathIllegalArgumentException for p = 2");
+        } catch (MathIllegalArgumentException ex) {
             // expected
         }
     }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/FractionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/FractionTest.java?rev=1044186&r1=1044185&r2=1044186&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/FractionTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/FractionTest.java Fri Dec 10 00:50:50 2010
@@ -17,6 +17,8 @@
 package org.apache.commons.math.fraction;
 
 import org.apache.commons.math.ConvergenceException;
+import org.apache.commons.math.exception.MathIllegalArgumentException;
+import org.apache.commons.math.exception.MathArithmeticException;
 import org.apache.commons.math.TestUtils;
 import org.apache.commons.math.util.FastMath;
 
@@ -47,13 +49,13 @@ public class FractionTest extends TestCa
         try {
             new Fraction(Integer.MIN_VALUE, -1);
             fail();
-        } catch (ArithmeticException ex) {
+        } catch (MathArithmeticException ex) {
             // success
         }
         try {
             new Fraction(1, Integer.MIN_VALUE);
             fail();
-        } catch (ArithmeticException ex) {
+        } catch (MathArithmeticException ex) {
             // success
         }
         try {
@@ -256,8 +258,8 @@ public class FractionTest extends TestCa
         f = new Fraction(0, 3);
         try {
             f = f.reciprocal();
-            fail("expecting ArithmeticException");
-        } catch (ArithmeticException ex) {}
+            fail("expecting MathArithmeticException");
+        } catch (MathArithmeticException ex) {}
 
         // large values
         f = new Fraction(Integer.MAX_VALUE, 1);
@@ -288,8 +290,8 @@ public class FractionTest extends TestCa
         f = new Fraction(Integer.MIN_VALUE, 1);
         try {
             f = f.negate();
-            fail("expecting ArithmeticException");
-        } catch (ArithmeticException ex) {}
+            fail("expecting MathArithmeticException");
+        } catch (MathArithmeticException ex) {}
     }
 
     public void testAdd() {
@@ -318,8 +320,8 @@ public class FractionTest extends TestCa
 
         try {
             f.add(null);
-            fail("expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {}
+            fail("expecting MathIllegalArgumentException");
+        } catch (MathIllegalArgumentException ex) {}
 
         // if this fraction is added naively, it will overflow.
         // check that it doesn't.
@@ -343,35 +345,35 @@ public class FractionTest extends TestCa
 
         try {
             f = f.add(Fraction.ONE); // should overflow
-            fail("expecting ArithmeticException but got: " + f.toString());
-        } catch (ArithmeticException ex) {}
+            fail("expecting MathArithmeticException but got: " + f.toString());
+        } catch (MathArithmeticException ex) {}
 
         // denominator should not be a multiple of 2 or 3 to trigger overflow
         f1 = new Fraction(Integer.MIN_VALUE, 5);
         f2 = new Fraction(-1,5);
         try {
             f = f1.add(f2); // should overflow
-            fail("expecting ArithmeticException but got: " + f.toString());
-        } catch (ArithmeticException ex) {}
+            fail("expecting MathArithmeticException but got: " + f.toString());
+        } catch (MathArithmeticException ex) {}
 
         try {
             f= new Fraction(-Integer.MAX_VALUE, 1);
             f = f.add(f);
-            fail("expecting ArithmeticException");
-        } catch (ArithmeticException ex) {}
+            fail("expecting MathArithmeticException");
+        } catch (MathArithmeticException ex) {}
 
         try {
             f= new Fraction(-Integer.MAX_VALUE, 1);
             f = f.add(f);
-            fail("expecting ArithmeticException");
-        } catch (ArithmeticException ex) {}
+            fail("expecting MathArithmeticException");
+        } catch (MathArithmeticException ex) {}
 
         f1 = new Fraction(3,327680);
         f2 = new Fraction(2,59049);
         try {
             f = f1.add(f2); // should overflow
-            fail("expecting ArithmeticException but got: " + f.toString());
-        } catch (ArithmeticException ex) {}
+            fail("expecting MathArithmeticException but got: " + f.toString());
+        } catch (MathArithmeticException ex) {}
     }
 
     public void testDivide() {
@@ -387,8 +389,8 @@ public class FractionTest extends TestCa
         Fraction f2 = Fraction.ZERO;
         try {
             f1.divide(f2);
-            fail("expecting ArithmeticException");
-        } catch (ArithmeticException ex) {}
+            fail("expecting MathArithmeticException");
+        } catch (MathArithmeticException ex) {}
 
         f1 = new Fraction(0, 5);
         f2 = new Fraction(2, 7);
@@ -414,19 +416,19 @@ public class FractionTest extends TestCa
 
         try {
             f.divide(null);
-            fail("IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {}
+            fail("MathIllegalArgumentException");
+        } catch (MathIllegalArgumentException ex) {}
 
         try {
             f1 = new Fraction(1, Integer.MAX_VALUE);
             f = f1.divide(f1.reciprocal());  // should overflow
-            fail("expecting ArithmeticException");
-        } catch (ArithmeticException ex) {}
+            fail("expecting MathArithmeticException");
+        } catch (MathArithmeticException ex) {}
         try {
             f1 = new Fraction(1, -Integer.MAX_VALUE);
             f = f1.divide(f1.reciprocal());  // should overflow
-            fail("expecting ArithmeticException");
-        } catch (ArithmeticException ex) {}
+            fail("expecting MathArithmeticException");
+        } catch (MathArithmeticException ex) {}
 
         f1 = new Fraction(6, 35);
         f  = f1.divide(15);
@@ -452,8 +454,8 @@ public class FractionTest extends TestCa
 
         try {
             f.multiply(null);
-            fail("expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {}
+            fail("expecting MathIllegalArgumentException");
+        } catch (MathIllegalArgumentException ex) {}
 
         f1 = new Fraction(6, 35);
         f  = f1.multiply(15);
@@ -473,8 +475,8 @@ public class FractionTest extends TestCa
         Fraction f = new Fraction(1,1);
         try {
             f.subtract(null);
-            fail("expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {}
+            fail("expecting MathIllegalArgumentException");
+        } catch (MathIllegalArgumentException ex) {}
 
         // if this fraction is subtracted naively, it will overflow.
         // check that it doesn't.
@@ -503,35 +505,35 @@ public class FractionTest extends TestCa
             f1 = new Fraction(1, Integer.MAX_VALUE);
             f2 = new Fraction(1, Integer.MAX_VALUE - 1);
             f = f1.subtract(f2);
-            fail("expecting ArithmeticException");  //should overflow
-        } catch (ArithmeticException ex) {}
+            fail("expecting MathArithmeticException");  //should overflow
+        } catch (MathArithmeticException ex) {}
 
         // denominator should not be a multiple of 2 or 3 to trigger overflow
         f1 = new Fraction(Integer.MIN_VALUE, 5);
         f2 = new Fraction(1,5);
         try {
             f = f1.subtract(f2); // should overflow
-            fail("expecting ArithmeticException but got: " + f.toString());
-        } catch (ArithmeticException ex) {}
+            fail("expecting MathArithmeticException but got: " + f.toString());
+        } catch (MathArithmeticException ex) {}
 
         try {
             f= new Fraction(Integer.MIN_VALUE, 1);
             f = f.subtract(Fraction.ONE);
-            fail("expecting ArithmeticException");
-        } catch (ArithmeticException ex) {}
+            fail("expecting MathArithmeticException");
+        } catch (MathArithmeticException ex) {}
 
         try {
             f= new Fraction(Integer.MAX_VALUE, 1);
             f = f.subtract(Fraction.ONE.negate());
-            fail("expecting ArithmeticException");
-        } catch (ArithmeticException ex) {}
+            fail("expecting MathArithmeticException");
+        } catch (MathArithmeticException ex) {}
 
         f1 = new Fraction(3,327680);
         f2 = new Fraction(2,59049);
         try {
             f = f1.subtract(f2); // should overflow
-            fail("expecting ArithmeticException but got: " + f.toString());
-        } catch (ArithmeticException ex) {}
+            fail("expecting MathArithmeticException but got: " + f.toString());
+        } catch (MathArithmeticException ex) {}
     }
 
     public void testEqualsAndHashCode() {
@@ -553,8 +555,8 @@ public class FractionTest extends TestCa
         assertTrue(Fraction.ZERO.equals(Fraction.getReducedFraction(0, -1)));
         try {
             Fraction.getReducedFraction(1, 0);
-            fail("expecting ArithmeticException");
-        } catch (ArithmeticException ex) {
+            fail("expecting MathArithmeticException");
+        } catch (MathArithmeticException ex) {
             // expected
         }
         assertEquals(Fraction.getReducedFraction

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/Array2DRowRealMatrixTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/Array2DRowRealMatrixTest.java?rev=1044186&r1=1044185&r2=1044186&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/Array2DRowRealMatrixTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/Array2DRowRealMatrixTest.java Fri Dec 10 00:50:50 2010
@@ -19,13 +19,16 @@ package org.apache.commons.math.linear;
 import junit.framework.TestCase;
 
 import org.apache.commons.math.TestUtils;
-import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.util.FastMath;
+import org.apache.commons.math.exception.MathUserException;
+import org.apache.commons.math.exception.DimensionMismatchException;
 import org.apache.commons.math.exception.MatrixDimensionMismatchException;
 import org.apache.commons.math.exception.OutOfRangeException;
 import org.apache.commons.math.exception.NoDataException;
 import org.apache.commons.math.exception.NumberIsTooSmallException;
 import org.apache.commons.math.exception.NonSquareMatrixException;
+import org.apache.commons.math.exception.MathIllegalArgumentException;
+import org.apache.commons.math.exception.MathIllegalStateException;
 
 /**
  * Test cases for the {@link Array2DRowRealMatrix} class.
@@ -142,8 +145,8 @@ public final class Array2DRowRealMatrixT
         Array2DRowRealMatrix m2 = new Array2DRowRealMatrix(testData2);
         try {
             m.add(m2);
-            fail("IllegalArgumentException expected");
-        } catch (IllegalArgumentException ex) {
+            fail("MathIllegalArgumentException expected");
+        } catch (MathIllegalArgumentException ex) {
             // ignored
         }
     }
@@ -173,7 +176,7 @@ public final class Array2DRowRealMatrixT
         try {
             m.subtract(new Array2DRowRealMatrix(testData2));
             fail("Expecting illegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (MathIllegalArgumentException ex) {
             // ignored
         }
     }
@@ -197,7 +200,7 @@ public final class Array2DRowRealMatrixT
         try {
             m.multiply(new Array2DRowRealMatrix(bigSingular));
             fail("Expecting illegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (MathIllegalArgumentException ex) {
             // ignored
         }
     }
@@ -246,7 +249,7 @@ public final class Array2DRowRealMatrixT
         try {
             m.operate(testVector);
             fail("Expecting illegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (MathIllegalArgumentException ex) {
             // ignored
         }
     }
@@ -284,8 +287,8 @@ public final class Array2DRowRealMatrixT
         m = new Array2DRowRealMatrix(bigSingular);
         try {
             m.preMultiply(testVector);
-            fail("expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+            fail("expecting MathIllegalArgumentException");
+        } catch (MathIllegalArgumentException ex) {
             // ignored
         }
     }
@@ -310,7 +313,7 @@ public final class Array2DRowRealMatrixT
         try {
             m.preMultiply(new Array2DRowRealMatrix(bigSingular));
             fail("Expecting illegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (MathIllegalArgumentException ex) {
             // ignored
         }
     }
@@ -848,30 +851,30 @@ public final class Array2DRowRealMatrixT
         Array2DRowRealMatrix m2 = new Array2DRowRealMatrix();
         try {
             m2.setSubMatrix(testData,0,1);
-            fail("expecting IllegalStateException");
-        } catch (IllegalStateException e) {
+            fail("expecting MathIllegalStateException");
+        } catch (MathIllegalStateException e) {
             // expected
         }
         try {
             m2.setSubMatrix(testData,1,0);
-            fail("expecting IllegalStateException");
-        } catch (IllegalStateException e) {
+            fail("expecting MathIllegalStateException");
+        } catch (MathIllegalStateException e) {
             // expected
         }
 
         // ragged
         try {
             m.setSubMatrix(new double[][] {{1}, {2, 3}}, 0, 0);
-            fail("expecting IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
+            fail("expecting MathIllegalArgumentException");
+        } catch (MathIllegalArgumentException e) {
             // expected
         }
 
         // empty
         try {
             m.setSubMatrix(new double[][] {{}}, 0, 0);
-            fail("expecting IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
+            fail("expecting MathIllegalArgumentException");
+        } catch (MathIllegalArgumentException e) {
             // expected
         }
 
@@ -992,13 +995,22 @@ public final class Array2DRowRealMatrixT
 
     /** extracts the l  and u matrices from compact lu representation */
     protected void splitLU(RealMatrix lu, double[][] lowerData, double[][] upperData) {
-        if (!lu.isSquare() ||
-            lowerData.length != lowerData[0].length ||
-            upperData.length != upperData[0].length ||
-            lowerData.length != upperData.length ||
-            lowerData.length != lu.getRowDimension()) {
-            throw new IllegalArgumentException("incorrect dimensions");
+        if (!lu.isSquare()) {
+            throw new NonSquareMatrixException(lu.getRowDimension(), lu.getColumnDimension());
+        }
+        if (lowerData.length != lowerData[0].length) {
+            throw new DimensionMismatchException(lowerData.length, lowerData[0].length);
+        }
+        if (upperData.length != upperData[0].length) {
+            throw new DimensionMismatchException(upperData.length, upperData[0].length);
+        }
+        if (lowerData.length != upperData.length) {
+            throw new DimensionMismatchException(lowerData.length, upperData.length);
         }
+        if (lowerData.length != lu.getRowDimension()) {
+            throw new DimensionMismatchException(lowerData.length, lu.getRowDimension());
+        }
+
         int n = lu.getRowDimension();
         for (int i = 0; i < n; i++) {
             for (int j = 0; j < n; j++) {
@@ -1018,9 +1030,14 @@ public final class Array2DRowRealMatrixT
 
     /** Returns the result of applying the given row permutation to the matrix */
     protected RealMatrix permuteRows(RealMatrix matrix, int[] permutation) {
-        if (!matrix.isSquare() || matrix.getRowDimension() != permutation.length) {
-            throw new IllegalArgumentException("dimension mismatch");
+        if (!matrix.isSquare()) {
+            throw new NonSquareMatrixException(matrix.getRowDimension(),
+                                               matrix.getColumnDimension());
         }
+        if (matrix.getRowDimension() != permutation.length) {
+            throw new DimensionMismatchException(matrix.getRowDimension(), permutation.length);
+        }
+
         int n = matrix.getRowDimension();
         int m = matrix.getColumnDimension();
         double out[][] = new double[m][n];

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/ArrayFieldVectorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/ArrayFieldVectorTest.java?rev=1044186&r1=1044185&r2=1044186&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/ArrayFieldVectorTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/ArrayFieldVectorTest.java Fri Dec 10 00:50:50 2010
@@ -27,6 +27,7 @@ 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.OutOfRangeException;
+import org.apache.commons.math.exception.MathIllegalArgumentException;
 
 /**
  * Test cases for the {@link ArrayFieldVector} class.
@@ -275,8 +276,8 @@ public class ArrayFieldVectorTest extend
         assertEquals(new Fraction(4), v4.getEntry(0));
         try {
             new ArrayFieldVector<Fraction>(vec4, 8, 3);
-            fail("IllegalArgumentException expected");
-        } catch (IllegalArgumentException ex) {
+            fail("MathIllegalArgumentException expected");
+        } catch (MathIllegalArgumentException ex) {
             // expected behavior
         }
 
@@ -293,8 +294,8 @@ public class ArrayFieldVectorTest extend
         assertEquals(new Fraction(4), v6.getEntry(0));
         try {
             new ArrayFieldVector<Fraction>(dvec1, 8, 3);
-            fail("IllegalArgumentException expected");
-        } catch (IllegalArgumentException ex) {
+            fail("MathIllegalArgumentException expected");
+        } catch (MathIllegalArgumentException ex) {
             // expected behavior
         }
 
@@ -565,22 +566,22 @@ public class ArrayFieldVectorTest extend
          */
         try {
             v1.checkVectorDimensions(2);
-            fail("IllegalArgumentException expected");
-        } catch (IllegalArgumentException ex) {
+            fail("MathIllegalArgumentException expected");
+        } catch (MathIllegalArgumentException ex) {
             // expected behavior
         }
 
        try {
             v1.checkVectorDimensions(v4);
-            fail("IllegalArgumentException expected");
-        } catch (IllegalArgumentException ex) {
+            fail("MathIllegalArgumentException expected");
+        } catch (MathIllegalArgumentException ex) {
             // expected behavior
         }
 
         try {
             v1.checkVectorDimensions(v4_2);
-            fail("IllegalArgumentException expected");
-        } catch (IllegalArgumentException ex) {
+            fail("MathIllegalArgumentException expected");
+        } catch (MathIllegalArgumentException ex) {
             // expected behavior
         }
 
@@ -596,20 +597,20 @@ public class ArrayFieldVectorTest extend
         // when the field is not specified, array cannot be empty
         try {
             new ArrayFieldVector<Fraction>(new Fraction[0]);
-            fail("IllegalArgumentException expected");
-        } catch (IllegalArgumentException ex) {
+            fail("MathIllegalArgumentException expected");
+        } catch (MathIllegalArgumentException ex) {
             // expected behavior
         }
         try {
             new ArrayFieldVector<Fraction>(new Fraction[0], true);
-            fail("IllegalArgumentException expected");
-        } catch (IllegalArgumentException ex) {
+            fail("MathIllegalArgumentException expected");
+        } catch (MathIllegalArgumentException ex) {
             // expected behavior
         }
         try {
             new ArrayFieldVector<Fraction>(new Fraction[0], false);
-            fail("IllegalArgumentException expected");
-        } catch (IllegalArgumentException ex) {
+            fail("MathIllegalArgumentException expected");
+        } catch (MathIllegalArgumentException ex) {
             // expected behavior
         }
 

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/ArrayRealVectorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/ArrayRealVectorTest.java?rev=1044186&r1=1044185&r2=1044186&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/ArrayRealVectorTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/ArrayRealVectorTest.java Fri Dec 10 00:50:50 2010
@@ -25,6 +25,8 @@ import org.apache.commons.math.TestUtils
 import org.apache.commons.math.analysis.UnivariateRealFunction;
 import org.apache.commons.math.util.FastMath;
 import org.apache.commons.math.exception.OutOfRangeException;
+import org.apache.commons.math.exception.MathIllegalArgumentException;
+import org.apache.commons.math.exception.MathArithmeticException;
 import org.apache.commons.math.analysis.function.Abs;
 import org.apache.commons.math.analysis.function.Acos;
 import org.apache.commons.math.analysis.function.Asin;
@@ -368,8 +370,8 @@ public class ArrayRealVectorTest {
         Assert.assertEquals("testData is 4.0 ", 4.0, v4.getEntry(0), 0);
         try {
             new ArrayRealVector(vec4, 8, 3);
-            Assert.fail("IllegalArgumentException expected");
-        } catch (IllegalArgumentException ex) {
+            Assert.fail("MathIllegalArgumentException expected");
+        } catch (MathIllegalArgumentException ex) {
             // expected behavior
         }
 
@@ -386,8 +388,8 @@ public class ArrayRealVectorTest {
         Assert.assertEquals("testData is 4.0 ", 4.0, v6.getEntry(0), 0);
         try {
             new ArrayRealVector(dvec1, 8, 3);
-            Assert.fail("IllegalArgumentException expected");
-        } catch (IllegalArgumentException ex) {
+            Assert.fail("MathIllegalArgumentException expected");
+        } catch (MathIllegalArgumentException ex) {
             // expected behavior
         }
 
@@ -996,8 +998,8 @@ public class ArrayRealVectorTest {
 
         try {
             v_null.unitVector();
-            Assert.fail("Expecting ArithmeticException");
-        } catch (ArithmeticException ex) {
+            Assert.fail("Expecting MathArithmeticException");
+        } catch (MathArithmeticException ex) {
             // expected behavior
         }
 
@@ -1006,8 +1008,8 @@ public class ArrayRealVectorTest {
         assertClose("compare vect" ,v_unitVector_2.getData(),v_unitize.getData(),normTolerance);
         try {
             v_null.unitize();
-            Assert.fail("Expecting ArithmeticException");
-        } catch (ArithmeticException ex) {
+            Assert.fail("Expecting MathArithmeticException");
+        } catch (MathArithmeticException ex) {
             // expected behavior
         }
 
@@ -1040,22 +1042,22 @@ public class ArrayRealVectorTest {
          */
         try {
             v1.checkVectorDimensions(2);
-            Assert.fail("IllegalArgumentException expected");
-        } catch (IllegalArgumentException ex) {
+            Assert.fail("MathIllegalArgumentException expected");
+        } catch (MathIllegalArgumentException ex) {
             // expected behavior
         }
 
        try {
             v1.checkVectorDimensions(v4);
-            Assert.fail("IllegalArgumentException expected");
-        } catch (IllegalArgumentException ex) {
+            Assert.fail("MathIllegalArgumentException expected");
+        } catch (MathIllegalArgumentException ex) {
             // expected behavior
         }
 
         try {
             v1.checkVectorDimensions(v4_2);
-            Assert.fail("IllegalArgumentException expected");
-        } catch (IllegalArgumentException ex) {
+            Assert.fail("MathIllegalArgumentException expected");
+        } catch (MathIllegalArgumentException ex) {
             // expected behavior
         }
 

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=1044186&r1=1044185&r2=1044186&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 Fri Dec 10 00:50:50 2010
@@ -31,6 +31,7 @@ import org.apache.commons.math.exception
 import org.apache.commons.math.exception.NumberIsTooSmallException;
 import org.apache.commons.math.exception.NotStrictlyPositiveException;
 import org.apache.commons.math.exception.NonSquareMatrixException;
+import org.apache.commons.math.exception.MathIllegalArgumentException;
 
 /**
  * Test cases for the {@link BlockFieldMatrix} class.
@@ -203,8 +204,8 @@ public final class BlockFieldMatrixTest 
         BlockFieldMatrix<Fraction> m2 = new BlockFieldMatrix<Fraction>(testData2);
         try {
             m.add(m2);
-            fail("IllegalArgumentException expected");
-        } catch (IllegalArgumentException ex) {
+            fail("MathIllegalArgumentException expected");
+        } catch (MathIllegalArgumentException ex) {
             // ignored
         }
     }
@@ -217,7 +218,7 @@ public final class BlockFieldMatrixTest 
         try {
             m.subtract(new BlockFieldMatrix<Fraction>(testData2));
             fail("Expecting illegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (MathIllegalArgumentException ex) {
             // ignored
         }
     }
@@ -236,7 +237,7 @@ public final class BlockFieldMatrixTest 
         try {
             m.multiply(new BlockFieldMatrix<Fraction>(bigSingular));
             fail("Expecting illegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (MathIllegalArgumentException ex) {
             // expected
         }
     }
@@ -376,7 +377,7 @@ public final class BlockFieldMatrixTest 
         try {
             m.operate(testVector);
             fail("Expecting illegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (MathIllegalArgumentException ex) {
             // ignored
         }
     }
@@ -441,8 +442,8 @@ public final class BlockFieldMatrixTest 
         m = new BlockFieldMatrix<Fraction>(bigSingular);
         try {
             m.preMultiply(testVector);
-            fail("expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+            fail("expecting MathIllegalArgumentException");
+        } catch (MathIllegalArgumentException ex) {
             // ignored
         }
     }
@@ -463,7 +464,7 @@ public final class BlockFieldMatrixTest 
         try {
             m.preMultiply(new BlockFieldMatrix<Fraction>(bigSingular));
             fail("Expecting illegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (MathIllegalArgumentException ex) {
             // ignored
         }
     }
@@ -1183,16 +1184,16 @@ public final class BlockFieldMatrixTest 
         // ragged
         try {
             m.setSubMatrix(new Fraction[][] {{new Fraction(1)}, {new Fraction(2), new Fraction(3)}}, 0, 0);
-            fail("expecting IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
+            fail("expecting MathIllegalArgumentException");
+        } catch (MathIllegalArgumentException e) {
             // expected
         }
 
         // empty
         try {
             m.setSubMatrix(new Fraction[][] {{}}, 0, 0);
-            fail("expecting IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
+            fail("expecting MathIllegalArgumentException");
+        } catch (MathIllegalArgumentException e) {
             // expected
         }
 

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/BlockRealMatrixTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/BlockRealMatrixTest.java?rev=1044186&r1=1044185&r2=1044186&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/BlockRealMatrixTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/BlockRealMatrixTest.java Fri Dec 10 00:50:50 2010
@@ -29,6 +29,7 @@ import org.apache.commons.math.exception
 import org.apache.commons.math.exception.NoDataException;
 import org.apache.commons.math.exception.NumberIsTooSmallException;
 import org.apache.commons.math.exception.NonSquareMatrixException;
+import org.apache.commons.math.exception.MathIllegalArgumentException;
 
 /**
  * Test cases for the {@link BlockRealMatrix} class.
@@ -146,8 +147,8 @@ public final class BlockRealMatrixTest e
         BlockRealMatrix m2 = new BlockRealMatrix(testData2);
         try {
             m.add(m2);
-            fail("IllegalArgumentException expected");
-        } catch (IllegalArgumentException ex) {
+            fail("MathIllegalArgumentException expected");
+        } catch (MathIllegalArgumentException ex) {
             // ignored
         }
     }
@@ -176,7 +177,7 @@ public final class BlockRealMatrixTest e
         try {
             m.subtract(new BlockRealMatrix(testData2));
             fail("Expecting illegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (MathIllegalArgumentException ex) {
             // ignored
         }
     }
@@ -195,7 +196,7 @@ public final class BlockRealMatrixTest e
         try {
             m.multiply(new BlockRealMatrix(bigSingular));
             fail("Expecting illegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (MathIllegalArgumentException ex) {
             // expected
         }
     }
@@ -325,7 +326,7 @@ public final class BlockRealMatrixTest e
         try {
             m.operate(testVector);
             fail("Expecting illegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (MathIllegalArgumentException ex) {
             // ignored
         }
     }
@@ -388,8 +389,8 @@ public final class BlockRealMatrixTest e
         m = new BlockRealMatrix(bigSingular);
         try {
             m.preMultiply(testVector);
-            fail("expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+            fail("expecting MathIllegalArgumentException");
+        } catch (MathIllegalArgumentException ex) {
             // ignored
         }
     }
@@ -410,7 +411,7 @@ public final class BlockRealMatrixTest e
         try {
             m.preMultiply(new BlockRealMatrix(bigSingular));
             fail("Expecting illegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (MathIllegalArgumentException ex) {
             // ignored
         }
     }
@@ -1085,16 +1086,16 @@ public final class BlockRealMatrixTest e
         // ragged
         try {
             m.setSubMatrix(new double[][] {{1}, {2, 3}}, 0, 0);
-            fail("expecting IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
+            fail("expecting MathIllegalArgumentException");
+        } catch (MathIllegalArgumentException e) {
             // expected
         }
 
         // empty
         try {
             m.setSubMatrix(new double[][] {{}}, 0, 0);
-            fail("expecting IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
+            fail("expecting MathIllegalArgumentException");
+        } catch (MathIllegalArgumentException e) {
             // expected
         }
 

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/CholeskySolverTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/CholeskySolverTest.java?rev=1044186&r1=1044185&r2=1044186&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/CholeskySolverTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/CholeskySolverTest.java Fri Dec 10 00:50:50 2010
@@ -17,6 +17,8 @@
 
 package org.apache.commons.math.linear;
 
+import org.apache.commons.math.exception.MathIllegalArgumentException;
+
 import junit.framework.TestCase;
 
 public class CholeskySolverTest extends TestCase {
@@ -41,19 +43,19 @@ public class CholeskySolverTest extends 
         try {
             solver.solve(b);
             fail("an exception should have been thrown");
-        } catch (IllegalArgumentException iae) {
+        } catch (MathIllegalArgumentException iae) {
             // expected behavior
         }
         try {
             solver.solve(b.getColumn(0));
             fail("an exception should have been thrown");
-        } catch (IllegalArgumentException iae) {
+        } catch (MathIllegalArgumentException iae) {
             // expected behavior
         }
         try {
             solver.solve(new ArrayRealVectorTest.RealVectorTestImpl(b.getColumn(0)));
             fail("an exception should have been thrown");
-        } catch (IllegalArgumentException iae) {
+        } catch (MathIllegalArgumentException iae) {
             // expected behavior
         }
     }



Mime
View raw message