[kaffe] CVS kaffe (robilad): Resynced DecimalFormatSymbols with Classpath

Kaffe CVS cvs-commits at kaffe.org
Wed Jan 26 06:37:45 PST 2005


PatchSet 5921 
Date: 2005/01/26 14:33:02
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced DecimalFormatSymbols with Classpath

Members: 
	ChangeLog:1.3460->1.3461 
	libraries/javalib/java/text/DecimalFormatSymbols.java:1.19->1.20 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3460 kaffe/ChangeLog:1.3461
--- kaffe/ChangeLog:1.3460	Wed Jan 26 14:19:41 2005
+++ kaffe/ChangeLog	Wed Jan 26 14:33:02 2005
@@ -1,5 +1,11 @@
 2005-01-26  Dalibor Topic  <robilad at kaffe.org>
 
+        * java/text/DecimalFormatSymbols.java: Resynced with GNU Classpath.
+
+	Reported by:  Mark Wielaard  <mark at klomp.org>
+
+2005-01-26  Dalibor Topic  <robilad at kaffe.org>
+
         Resynced with GNU Classpath.
 
 	2005-01-25  Ito Kazumitsu  <kaz at maczuka.gcd.org>
Index: kaffe/libraries/javalib/java/text/DecimalFormatSymbols.java
diff -u kaffe/libraries/javalib/java/text/DecimalFormatSymbols.java:1.19 kaffe/libraries/javalib/java/text/DecimalFormatSymbols.java:1.20
--- kaffe/libraries/javalib/java/text/DecimalFormatSymbols.java:1.19	Thu Jan  6 13:03:51 2005
+++ kaffe/libraries/javalib/java/text/DecimalFormatSymbols.java	Wed Jan 26 14:33:06 2005
@@ -132,6 +132,12 @@
   /**
    * This method initializes a new instance of
    * <code>DecimalFormatSymbols</code> for the specified locale.
+   * <strong>Note</strong>: if the locale does not have an associated
+   * <code>Currency</code> instance, the currency symbol and
+   * international currency symbol will be set to the strings "?"
+   * and "XXX" respectively.  This generally happens with language
+   * locales (those with no specified country), such as
+   * <code>Locale.ENGLISH</code>.
    *
    * @param locale The local to load symbols for.
    * @throws NullPointerException if the locale is null.
@@ -139,6 +145,10 @@
   public DecimalFormatSymbols (Locale loc)
   {
     ResourceBundle res;
+
+    currency = null;
+    currencySymbol = "?";
+    intlCurrencySymbol = "XXX";
     try
       {
 	res = ResourceBundle.getBundle("gnu.java.locale.LocaleInformation",
@@ -148,7 +158,18 @@
       {
 	res = null;
       }
-    setCurrency(Currency.getInstance(loc));
+    try
+      {
+	Currency localeCurrency = Currency.getInstance(loc);
+	if (localeCurrency != null)
+	  {
+	    setCurrency(localeCurrency);
+	  }
+      }
+    catch(IllegalArgumentException exception)
+      {
+	/* Locale has an invalid currency */
+      }
     decimalSeparator = safeGetChar (res, "decimalSeparator", '.');
     digit = safeGetChar (res, "digit", '#');
     exponential = safeGetChar (res, "exponential", 'E');
@@ -393,9 +414,9 @@
    */
   public void setCurrency (Currency currency)
   {
-    this.currency = currency;
     intlCurrencySymbol = currency.getCurrencyCode();
     currencySymbol = currency.getSymbol();
+    this.currency = currency;
   }
 
   /**




More information about the kaffe mailing list