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: r1035003 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/exception/util/MessageFactory.java test/java/org/apache/commons/math/exception/util/MessageFactoryTest.java
Date Sun, 14 Nov 2010 23:13:17 GMT
Hi.

> [...]
> 
> So what I propose the following set of constructors :
>  - no argument
>      -> this would lead to the default message USER_EXCEPTION
>  - a throwable
>      -> this would lead to the default message USER_EXCEPTION
>  - a throwable and one pattern
>      -> this would be used to specify the generic part
>  - a throwable and two patterns
>      -> this would be used to specify both the generic
>          and the specific part

As I said, this is similar to the code of "MathIllegalArgumentException".
That's fine.

> In fact, all these constructors end up calling the last one, by adding
> some null arguments. All arguments can be null.

No, IMHO, the "general" parameter should not be null.
If a user defines a class that inherit from "MathUserException", the meaning
will exist and should be reflected in the "general" pattern.
[Allowing null is suggesting to use this "tool" in a wrong way.]

However, this is really nitpicking; the result will just be useless empty
error message, and that will be the user's fault. So, allow "null" if you
like ;-)

> [...]


Best regards,
Gilles

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


Mime
View raw message