commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: svn commit: r962515 - in /commons/proper/math/trunk/src/main: java/org/apache/commons/math/analysis/polynomials/ java/org/apache/commons/math/exception/ java/org/apache/commons/math/random/ java/org/apache/commons/math/util/ resources/META-INF/lo
Date Fri, 09 Jul 2010 14:26:39 GMT
On 9 July 2010 14:15,  <erans@apache.org> wrote:
> Author: erans
> Date: Fri Jul  9 13:15:28 2010
> New Revision: 962515
>
> URL: http://svn.apache.org/viewvc?rev=962515&view=rev
> Log:
> MATH-361
>
> Modified:
>    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunction.java
>    commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/NotPositiveException.java
>    commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/NotStrictlyPositiveException.java
>    commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/NumberIsTooLargeException.java
>    commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/AbstractRandomGenerator.java
>    commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/BitsStreamGenerator.java
>    commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/RandomDataImpl.java
>    commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/UncorrelatedRandomVectorGenerator.java
>    commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/LocalizedFormats.java
>    commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties
>
> Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunction.java
> URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunction.java?rev=962515&r1=962514&r2=962515&view=diff
> ==============================================================================
> --- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunction.java
(original)
> +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunction.java
Fri Jul  9 13:15:28 2010
> @@ -19,7 +19,7 @@ package org.apache.commons.math.analysis
>  import java.io.Serializable;
>  import java.util.Arrays;
>
> -import org.apache.commons.math.MathRuntimeException;
> +import org.apache.commons.math.exception.NotStrictlyPositiveException;
>  import org.apache.commons.math.analysis.DifferentiableUnivariateRealFunction;
>  import org.apache.commons.math.analysis.UnivariateRealFunction;
>  import org.apache.commons.math.util.LocalizedFormats;
> @@ -58,12 +58,13 @@ public class PolynomialFunction implemen
>      *
>      * @param c polynomial coefficients
>      * @throws NullPointerException if c is null
> -     * @throws IllegalArgumentException if c is empty
> +     * @throws NotStrictlyPositiveException if c is empty
>      */
>     public PolynomialFunction(double c[]) {
>         super();
>         if (c.length < 1) {
> -            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.EMPTY_POLYNOMIALS_COEFFICIENTS_ARRAY);
> +            throw new NotStrictlyPositiveException(LocalizedFormats.EMPTY_POLYNOMIALS_COEFFICIENTS_ARRAY,
> +                                                   c.length);
>         }

Seems very odd to me to reject an empty array parameter with
"NotStrictlyPositiveException".

I would expect that to be reserved for numeric data passed as a
parameter or as an array entry.

IllegalArgument seems much clearer to me; alternatively one could
perhaps create an EmptyArrayNotAllowedException, if this is a common
requirement.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message