classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Compliance of DecimalFormatSymbols


From: Guilhem Lavaux
Subject: [PATCH] Compliance of DecimalFormatSymbols
Date: Fri, 21 Nov 2003 20:21:40 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030630

Hi,

Here is an adaptation of the former patch concerning java/text.
This one is small and concerns only java/text/DecimalFormatSymbols.
According to the official specification, if the serial version is greater
than 2, you have to read the locale field. This is what is done here.

Regards,
Guilhem.

ChangeLog entry:

2003-11-21 Guilhem Lavaux <address@hidden>

  * java/text/DecimalFormatSymbols.java    (locale): New field.
  (serialVersionOnStream): Upgraded to number 2
  (readObject): updated to assign locale if it wasn't by the
  serializer.

Index: java/text/DecimalFormatSymbols.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/text/DecimalFormatSymbols.java,v
retrieving revision 1.7
diff -u -r1.7 DecimalFormatSymbols.java
--- java/text/DecimalFormatSymbols.java 15 Nov 2003 21:45:27 -0000      1.7
+++ java/text/DecimalFormatSymbols.java 21 Nov 2003 19:14:00 -0000
@@ -158,6 +158,7 @@
     percent = safeGetChar (res, "percent", '%');
     perMill = safeGetChar (res, "perMill", '\u2030');
     zeroDigit = safeGetChar (res, "zeroDigit", '0');
+    locale = loc;
   }
 
   /**
@@ -580,13 +581,20 @@
   /**
    * @serial This value represents the type of object being de-serialized.
    * 0 indicates a pre-Java 1.1.6 version, 1 indicates 1.1.6 or later.
-   */
-  private int serialVersionOnStream = 1;
+   * 0 indicates a pre-Java 1.1.6 version, 1 indicates 1.1.6 or later,
+   * 2 indicates 1.4 or later
+    */
+  private int serialVersionOnStream = 2;
   /**
    * @serial This is the character used to represent 0.
    */
   private char zeroDigit;
 
+  /**
+   * @serial the locale of these currency symbols.
+   */
+  private Locale locale;
+ 
   private static final long serialVersionUID = 5772796243397350300L;
 
   private void readObject(ObjectInputStream stream)
@@ -597,7 +605,11 @@
       {
         monetarySeparator = decimalSeparator;
        exponential = 'E';
-       serialVersionOnStream = 1;
       }
+    if (serialVersionOnStream < 2)
+      {
+       locale = Locale.getDefault();
+      }
+    serialVersionOnStream = 2;
   }
 }

reply via email to

[Prev in Thread] Current Thread [Next in Thread]