diff options
author | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2005-04-16 01:22:52 +0000 |
---|---|---|
committer | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2005-04-16 01:22:52 +0000 |
commit | fac6a094be0f8e14dcc947d1eb81abcea19d9c92 (patch) | |
tree | 0a1a86b0a5118bc822d1ddb82661c518e1f3ee91 /java | |
parent | 146673a185ee398531881756d5d2f0bbc353e5ad (diff) | |
download | classpath-fac6a094be0f8e14dcc947d1eb81abcea19d9c92.tar.gz |
2005-04-15 Andrew John Hughes <gnu_andrew@member.fsf.org>
* java/text/DecimalFormatSymbols.java:
Added retrieval of "XXX" instance in place of null.
* java/util/Currency.java,
(Currency(String)): New constructor for the XXX special case.
(getInstance(String)): Allow special case of "XXX".
Diffstat (limited to 'java')
-rw-r--r-- | java/text/DecimalFormatSymbols.java | 2 | ||||
-rw-r--r-- | java/util/Currency.java | 19 |
2 files changed, 19 insertions, 2 deletions
diff --git a/java/text/DecimalFormatSymbols.java b/java/text/DecimalFormatSymbols.java index b596233d4..01ead2412 100644 --- a/java/text/DecimalFormatSymbols.java +++ b/java/text/DecimalFormatSymbols.java @@ -146,7 +146,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable { ResourceBundle res; - currency = null; + currency = Currency.getInstance("XXX"); currencySymbol = "?"; intlCurrencySymbol = "XXX"; try diff --git a/java/util/Currency.java b/java/util/Currency.java index 1a364f0c4..ec8fe3d52 100644 --- a/java/util/Currency.java +++ b/java/util/Currency.java @@ -199,6 +199,19 @@ public final class Currency } /** + * Constructor for the "XXX" special case. This allows + * a Currency to be constructed from an assumed good + * currency code. + * + * @param code the code to use. + */ + private Currency(String code) + { + currencyCode = code; + fractionDigits = -1; /* Pseudo currency */ + } + + /** * Returns the ISO4217 currency code of this currency. * * @return a <code>String</code> containing currency code. @@ -303,12 +316,16 @@ public final class Currency /* * Throw a null pointer exception explicitly if currencyCode is null. - * One is not thrown otherwise. It results in an IllegalArgumentException. + * One is not thrown otherwise. It results in an + * IllegalArgumentException. */ if (currencyCode == null) { throw new NullPointerException("The supplied currency code is null."); } + /* Nasty special case to allow an erroneous currency... blame Sun */ + if (currencyCode.equals("XXX")) + return new Currency("XXX"); Currency newCurrency = (Currency) cache.get(currencyCode); if (newCurrency == null) { |