[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cp-patches] Currency question
From: |
Mark Wielaard |
Subject: |
Re: [cp-patches] Currency question |
Date: |
Thu, 20 Jan 2005 13:48:25 +0100 |
Hi,
On Thu, 2005-01-20 at 12:06 +0000, Andrew John Hughes wrote:
> On Thu, 2005-01-20 at 10:35, Mark Wielaard wrote:
> >
> > I started on improving the exception message of Currency to figure out
> > what goes wrong in this case:
> > http://brutus.apache.org/gump/kaffe/msv/xsdlib/gump_work/build_msv_xsdlib.html
> > "java.lang.IllegalArgumentException: The specified country code is
> > invalid"
> >
> > So I would propose this patch:
> >
> > --- java/util/Currency.java 17 Jan 2005 00:59:42 -0000 1.11
> > +++ java/util/Currency.java 20 Jan 2005 10:24:01 -0000
> > @@ -169,7 +169,8 @@
> > if (countryCode.equals(""))
> > {
> > throw new
> > - IllegalArgumentException("The specified country code is invalid");
> > + IllegalArgumentException("Invalid (empty) country code for
> > locale:"
> > + + loc);
> > }
> > /* Construct the key for the currency */
> > currencyKey = countryCode + ".currency";
> >
> > But reading the code a bit more it seems that this case is similar to
> > when the countryCode for an Locale is null. What would be the
> > best/expected approach here?
>
> I'd go with the patch, as it makes the message clearer and it then
> becomes obvious that the error is an empty string, rather than just an
> arbitrary invalid code. Please commit.
OK. Committed as:
2005-01-20 Mark Wielaard <address@hidden>
* java/util/Currency.java (Currency(Locale)): Add Locale to
IllegalArgumentException message.
> I'm wondering if this is a bug in some of our calling code.
Gump has some more errors with respect to Currency like in commons-math:
http://brutus.apache.org/gump/kaffe/jakarta-commons/commons-math/gump_work/build_jakarta-commons_commons-math.html
That one has a stacktrace.
Cheers,
Mark
signature.asc
Description: This is a digitally signed message part