commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles Sadowski <gil...@harfang.homelinux.org>
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 17:35:27 GMT
> >     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".

It just means that a 0 length is not allowed.

> 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;

"NotStrictlyPositiveException" is a subclass of "IllegalArgumentException".

> alternatively one could
> perhaps create an EmptyArrayNotAllowedException, if this is a common
> requirement.

Could be too.


Gilles

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


Mime
View raw message