Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B17F34AAE for ; Sun, 12 Jun 2011 15:57:54 +0000 (UTC) Received: (qmail 19477 invoked by uid 500); 12 Jun 2011 15:57:54 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 19412 invoked by uid 500); 12 Jun 2011 15:57:53 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 19405 invoked by uid 99); 12 Jun 2011 15:57:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 12 Jun 2011 15:57:53 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 12 Jun 2011 15:57:52 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 5F13723889E1; Sun, 12 Jun 2011 15:57:32 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@commons.apache.org From: psteitz@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110612155732.5F13723889E1@eris.apache.org> 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]); } } }