commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pste...@apache.org
Subject svn commit: r1134939 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/ChiSquareTestImpl.java
Date Sun, 12 Jun 2011 15:57:32 GMT
Author: psteitz
Date: Sun Jun 12 15:57:32 2011
New Revision: 1134939

URL: http://svn.apache.org/viewvc?rev=1134939&view=rev
Log:
Restored specificity in exception error messages.

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/ChiSquareTestImpl.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/ChiSquareTestImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/ChiSquareTestImpl.java?rev=1134939&r1=1134938&r2=1134939&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/ChiSquareTestImpl.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/ChiSquareTestImpl.java
Sun Jun 12 15:57:32 2011
@@ -20,7 +20,6 @@ import org.apache.commons.math.MathExcep
 import org.apache.commons.math.exception.NotPositiveException;
 import org.apache.commons.math.exception.NotStrictlyPositiveException;
 import org.apache.commons.math.exception.NullArgumentException;
-import org.apache.commons.math.exception.NumberIsTooSmallException;
 import org.apache.commons.math.exception.OutOfRangeException;
 import org.apache.commons.math.exception.DimensionMismatchException;
 import org.apache.commons.math.exception.MathIllegalArgumentException;
@@ -321,11 +320,13 @@ public class ChiSquareTestImpl implement
      */
     private void checkArray(long[][] in) {
         if (in.length < 2) {
-            throw new NumberIsTooSmallException(in.length, 2, true);
+            throw new MathIllegalArgumentException(
+                    LocalizedFormats.INSUFFICIENT_DIMENSION, in.length, 2);
         }
 
         if (in[0].length < 2) {
-            throw new NumberIsTooSmallException(in[0].length, 2, true);
+            throw new MathIllegalArgumentException(
+                    LocalizedFormats.INSUFFICIENT_DIMENSION, in[0].length, 2);
         }
 
         checkRectangular(in);
@@ -354,7 +355,7 @@ public class ChiSquareTestImpl implement
     }
 
     /**
-     * Check all entries of the input array are strictly postive.
+     * Check all entries of the input array are strictly positive.
      *
      * @param in Array to be tested.
      * @exception NotStrictlyPositiveException if one entry is not positive.
@@ -362,7 +363,9 @@ public class ChiSquareTestImpl implement
     private void checkPositive(double[] in) {
         for (int i = 0; i < in.length; i++) {
             if (in[i] <= 0) {
-                throw new NotStrictlyPositiveException(in[i]);
+                throw new MathIllegalArgumentException(
+                        LocalizedFormats.NOT_POSITIVE_ELEMENT_AT_INDEX,
+                        i, in[i]);
             }
         }
     }
@@ -376,7 +379,9 @@ public class ChiSquareTestImpl implement
     private void checkNonNegative(long[] in) {
         for (int i = 0; i < in.length; i++) {
             if (in[i] < 0) {
-                throw new NotPositiveException(in[i]);
+                throw new MathIllegalArgumentException(
+                        LocalizedFormats.NEGATIVE_ELEMENT_AT_INDEX,
+                        i, in[i]);
             }
         }
     }
@@ -391,7 +396,9 @@ public class ChiSquareTestImpl implement
         for (int i = 0; i < in.length; i ++) {
             for (int j = 0; j < in[i].length; j++) {
                 if (in[i][j] < 0) {
-                    throw new NotPositiveException(in[i][j]);
+                    throw new MathIllegalArgumentException(
+                            LocalizedFormats.NEGATIVE_ELEMENT_AT_2D_INDEX,
+                            i, j, in[i][j]);
                 }
             }
         }



Mime
View raw message