diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | java/text/DecimalFormatSymbols.java | 2 | ||||
-rw-r--r-- | java/util/Currency.java | 19 |
3 files changed, 27 insertions, 2 deletions
@@ -1,3 +1,11 @@ +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". + 2005-04-15 Roman Kennke <roman@kennke.org> * javax/swing/plaf/metal/MetalLookAndFeel.java 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) { |