Return-Path: X-Original-To: apmail-commons-dev-archive@www.apache.org Delivered-To: apmail-commons-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8DA6A9227 for ; Mon, 27 Feb 2012 10:25:23 +0000 (UTC) Received: (qmail 4831 invoked by uid 500); 27 Feb 2012 10:25:23 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 4743 invoked by uid 500); 27 Feb 2012 10:25:23 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 4734 invoked by uid 99); 27 Feb 2012 10:25:23 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Feb 2012 10:25:23 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [193.74.71.28] (HELO sif.is.scarlet.be) (193.74.71.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Feb 2012 10:25:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=scarlet.be; s=scarlet; t=1330338294; bh=4954CG112SKTeyxuXOwar+UnAgqvfBWNQj5D+4nCF20=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Transfer-Encoding:In-Reply-To; b=tZANXowYxt2Qz7qxOqJp/eArwJR2hrHIBhGeqDYuKEvI795bWI3iGG5FW4HMYaFS+ hYof9XOwYb/8c02B5zhuCG4UftS6aj6XthPYQsPu0+gS0k7TAWSf78VMooO3Y1c29m /7uhgVV1KMo2LbinIrwhfsMW8jk4Amt2NbM1heBw= Received: from mail.harfang.homelinux.org (ip-62-235-230-171.dsl.scarlet.be [62.235.230.171]) by sif.is.scarlet.be (8.14.5/8.14.5) with ESMTP id q1RAOrD0031722 for ; Mon, 27 Feb 2012 11:24:54 +0100 X-Scarlet: d=1330338294 c=62.235.230.171 Received: from localhost (mail.harfang.homelinux.org [192.168.20.11]) by mail.harfang.homelinux.org (Postfix) with ESMTP id D2FB161CF5 for ; Mon, 27 Feb 2012 11:24:52 +0100 (CET) Received: from mail.harfang.homelinux.org ([192.168.20.11]) by localhost (mail.harfang.homelinux.org [192.168.20.11]) (amavisd-new, port 10024) with ESMTP id p+m2ZVqvWesu for ; Mon, 27 Feb 2012 11:24:47 +0100 (CET) Received: from dusk.harfang.homelinux.org (mail.harfang.homelinux.org [192.168.20.11]) by mail.harfang.homelinux.org (Postfix) with ESMTP id 7D6DC617BA for ; Mon, 27 Feb 2012 11:24:47 +0100 (CET) Received: from eran by dusk.harfang.homelinux.org with local (Exim 4.77) (envelope-from ) id 1S1xl9-00072Z-Bc for dev@commons.apache.org; Mon, 27 Feb 2012 11:24:47 +0100 Date: Mon, 27 Feb 2012 11:24:46 +0100 From: Gilles Sadowski To: dev@commons.apache.org Subject: Re: [math] LocalizedFormats.DIVISION_BY_ZERO? Message-ID: <20120227102446.GF9687@dusk.harfang.homelinux.org> Mail-Followup-To: dev@commons.apache.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Operating-System: Tiny Tux X-PGP-Key-Fingerprint: 53B9 972E C2E6 B93C BEAD 7092 09E6 AF46 51D0 5641 User-Agent: Mutt/1.5.21 (2010-09-15) X-DCC-scarlet.be-Metrics: sif 20001; Body=1 Fuz1=1 Fuz2=1 X-Virus-Scanned: clamav-milter 0.97.1-exp at sif X-Virus-Status: Clean 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); 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).] Best, Gilles --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org For additional commands, e-mail: dev-help@commons.apache.org