On Mon, Feb 27, 2012 at 12:17:36PM +0100, Sébastien Brisard wrote:
> Hello,
> 
> 2012/2/27 Gilles Sadowski <gil...@harfang.homelinux.org>:
> > On Mon, Feb 27, 2012 at 07:28:30AM +0100, Sébastien Brisard wrote:
> >> Hello,
> >> while working on MATH-755, I've noticed that there is no error message
> >> corresponding to a division by zero. So for the time being, when such
> >> a situation occurs, I use "ZERO_NOT_ALLOWED", but I was considering
> >> adding an entry DIVISION_BY_ZERO to LocalizedFormats. What do you
> >> think? I could do this fairly quickly, in order not to interfere with
> >> the current release process.
> >
> > There are several (overlapping) entries, a.o.:
> >
> >    FRACTION("fraction"), /* keep */
> >    DENOMINATOR("denominator"), /* keep */
> >    ZERO_DENOMINATOR("denominator must be different from 0"),
> >    ZERO_DENOMINATOR_IN_FRACTION("zero denominator in fraction {0}/{1}"),
> >    ZERO_FRACTION_TO_DIVIDE_BY("the fraction to divide by must not be zero: 
> > {0}/{1}"),
> >    ZERO_NOT_ALLOWED("zero not allowed here");
> >    IDENTICAL_ABSCISSAS_DIVISION_BY_ZERO("identical abscissas x[{0}] == 
> > x[{1}] == {2} cause division by zero"),
> >
> > My preference would be to rationalize, using the "ExceptionContext" to add
> > more information where needed. E.g. something like:
> >
> >   MathArithmeticException iae = new 
> > MathArithmeticException(LocalizedFormats.FRACTION);
> >   iae.getContext().addMessage(LocalizedFormats.DENOMINATOR);
> >   iae.getContext().addMessage(LocalizedFormats.ZERO_NOT_ALLOWED);
> >
> I like this use of the context.
> 
> >
> > But, if "DIVISION_BY_ZERO" is going to be used in several places, it might
> > be good to add it. [Still, the redundant entries should at some point be
> > removed (their use being replaced by a combination of the basic ones).]
> >
> I have to say that my preference would be to have DIVISION_BY_ZERO as
> a "master" message, as it is pretty self-explanatory (and also
> standard across different libraries/softwares). Additional messages
> (like FRACTION, or DENOMINATOR) would be provided as context (if they
> do turn out to be informative). This is my preference,

OK.

> but in fact,
> any option suits me fine, provided that we do rationalize.

OK. OK. ;-)

> As this is
> not an API change, this can certainly wait. Shall I open a new ticket,
> or keep MATH-755 open for this purpose? (MATH-755 is supposed to fix
> 3.1 anyway).

You can keep it open, or maybe you'll solve it too before the release...


Regards,
Gilles

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

Reply via email to