summaryrefslogtreecommitdiff
path: root/libjava/java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/java')
-rw-r--r--libjava/java/sql/Date.java9
-rw-r--r--libjava/java/sql/Time.java9
-rw-r--r--libjava/java/sql/Timestamp.java9
-rw-r--r--libjava/java/text/ChoiceFormat.java2
-rw-r--r--libjava/java/text/DateFormat.java5
-rw-r--r--libjava/java/text/DateFormatSymbols.java2
-rw-r--r--libjava/java/text/DecimalFormat.java19
-rw-r--r--libjava/java/text/DecimalFormatSymbols.java41
-rw-r--r--libjava/java/text/NumberFormat.java43
-rw-r--r--libjava/java/text/SimpleDateFormat.java21
10 files changed, 138 insertions, 22 deletions
diff --git a/libjava/java/sql/Date.java b/libjava/java/sql/Date.java
index 65472e180d1..88ae8595f0d 100644
--- a/libjava/java/sql/Date.java
+++ b/libjava/java/sql/Date.java
@@ -1,5 +1,5 @@
/* Date.java -- Wrapper around java.util.Date
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,7 +35,7 @@ import java.text.SimpleDateFormat;
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
-public class Date extends java.util.Date implements java.io.Serializable
+public class Date extends java.util.Date
{
/*
@@ -47,6 +47,11 @@ public class Date extends java.util.Date implements java.io.Serializable
*/
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+/**
+ * This is the serialization UID for this class.
+ */
+private static final long serialVersionUID = 1511598038487230103L;
+
/*************************************************************************/
/*
diff --git a/libjava/java/sql/Time.java b/libjava/java/sql/Time.java
index e8086589832..3e0b2716b88 100644
--- a/libjava/java/sql/Time.java
+++ b/libjava/java/sql/Time.java
@@ -1,5 +1,5 @@
/* Time.java -- Wrapper around java.util.Date
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,7 +35,7 @@ import java.text.SimpleDateFormat;
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
-public class Time extends java.util.Date implements java.io.Serializable
+public class Time extends java.util.Date
{
/*
@@ -47,6 +47,11 @@ public class Time extends java.util.Date implements java.io.Serializable
*/
private static SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
+/**
+ * This is the serialization UID for this class.
+ */
+private static final long serialVersionUID = 8397324403548013681L;
+
/*************************************************************************/
/*
diff --git a/libjava/java/sql/Timestamp.java b/libjava/java/sql/Timestamp.java
index c12267ec9dc..f13b3a9d3f5 100644
--- a/libjava/java/sql/Timestamp.java
+++ b/libjava/java/sql/Timestamp.java
@@ -1,5 +1,5 @@
/* Time.java -- Wrapper around java.util.Date
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,7 +39,7 @@ import java.text.SimpleDateFormat;
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
-public class Timestamp extends java.util.Date implements java.io.Serializable
+public class Timestamp extends java.util.Date
{
/*
@@ -56,6 +56,11 @@ private static SimpleDateFormat parse_sdf =
private static SimpleDateFormat format_sdf =
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+/**
+ * This is the serialization UID for this class.
+ */
+private static final long serialVersionUID = 3581463369166924961L;
+
/*************************************************************************/
/*
diff --git a/libjava/java/text/ChoiceFormat.java b/libjava/java/text/ChoiceFormat.java
index da70114ac33..584ece5c0e4 100644
--- a/libjava/java/text/ChoiceFormat.java
+++ b/libjava/java/text/ChoiceFormat.java
@@ -307,4 +307,6 @@ public class ChoiceFormat extends NumberFormat
private static final int mantissaBits = 52;
// Number of exponent bits in a double.
private static final int exponentBits = 11;
+
+ private static final long serialVersionUID = 1795184449645032964L;
}
diff --git a/libjava/java/text/DateFormat.java b/libjava/java/text/DateFormat.java
index ee2178cd68f..604a1d5b2e5 100644
--- a/libjava/java/text/DateFormat.java
+++ b/libjava/java/text/DateFormat.java
@@ -219,11 +219,6 @@ public abstract class DateFormat extends Format implements Cloneable
return getDateTimeInstance (DEFAULT, DEFAULT, Locale.getDefault());
}
- public static final DateFormat getDateTimeInstance (int style)
- {
- return getDateTimeInstance (style, style, Locale.getDefault());
- }
-
public static final DateFormat getDateTimeInstance (int dateStyle,
int timeStyle)
{
diff --git a/libjava/java/text/DateFormatSymbols.java b/libjava/java/text/DateFormatSymbols.java
index 91b1292ef27..b63bf369209 100644
--- a/libjava/java/text/DateFormatSymbols.java
+++ b/libjava/java/text/DateFormatSymbols.java
@@ -33,6 +33,8 @@ public class DateFormatSymbols extends Object
private String[] weekdays;
private String[][] zoneStrings;
+ private static final long serialVersionUID = -5987973545549424702L;
+
private static final String[] ampmsDefault = {"AM", "PM" };
private static final String[] erasDefault = {"BC", "AD" };
// localPatternCharsDefault is used by SimpleDateFormat.
diff --git a/libjava/java/text/DecimalFormat.java b/libjava/java/text/DecimalFormat.java
index 9e7513eebaa..42c81078cb2 100644
--- a/libjava/java/text/DecimalFormat.java
+++ b/libjava/java/text/DecimalFormat.java
@@ -1,6 +1,6 @@
// DecimalFormat.java - Localized number formatting.
-/* Copyright (C) 1999 Free Software Foundation
+/* Copyright (C) 1999, 2000 Free Software Foundation
This file is part of libgcj.
@@ -13,6 +13,8 @@ package java.text;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
+import java.io.ObjectInputStream;
+import java.io.IOException;
/**
* @author Tom Tromey <tromey@cygnus.com>
@@ -20,7 +22,7 @@ import java.util.ResourceBundle;
*/
/* Written using "Java Class Libraries", 2nd edition, plus online
* API docs for JDK 1.2 from http://www.javasoft.com.
- * Status: Believed complete and correct to 1.2, except serialization.
+ * Status: Believed complete and correct to 1.2.
* Note however that the docs are very unclear about how format parsing
* should work. No doubt there are problems here.
*/
@@ -976,8 +978,21 @@ public class DecimalFormat extends NumberFormat
private String negativeSuffix;
private String positivePrefix;
private String positiveSuffix;
+ private int serialVersionOnStream = 1;
private DecimalFormatSymbols symbols;
private boolean useExponentialNotation;
+ private static final long serialVersionUID = 864413376551465018L;
+
+ private void readObject(ObjectInputStream stream)
+ throws IOException, ClassNotFoundException
+ {
+ stream.defaultReadObject();
+ if (serialVersionOnStream < 1)
+ {
+ useExponentialNotation = false;
+ serialVersionOnStream = 1;
+ }
+ }
// The locale-independent pattern symbols happen to be the same as
// the US symbols.
diff --git a/libjava/java/text/DecimalFormatSymbols.java b/libjava/java/text/DecimalFormatSymbols.java
index 1d51fbdb42f..2f8a0a126dd 100644
--- a/libjava/java/text/DecimalFormatSymbols.java
+++ b/libjava/java/text/DecimalFormatSymbols.java
@@ -1,6 +1,6 @@
// DecimalFormatSymbols.java - Symbols used to format numbers.
-/* Copyright (C) 1999 Free Software Foundation
+/* Copyright (C) 1999, 2000 Free Software Foundation
This file is part of libgcj.
@@ -14,6 +14,8 @@ import java.io.Serializable;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
+import java.io.ObjectInputStream;
+import java.io.IOException;
/**
* @author Tom Tromey <tromey@cygnus.com>
@@ -21,7 +23,7 @@ import java.util.ResourceBundle;
*/
/* Written using "Java Class Libraries", 2nd edition, plus online
* API docs for JDK 1.2 from http://www.javasoft.com.
- * Status: Believed complete and correct to 1.2, except serialization.
+ * Status: Believed complete and correct to 1.2.
*/
public final class DecimalFormatSymbols implements Cloneable, Serializable
@@ -40,6 +42,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
this.groupingSeparator = orig.groupingSeparator;
this.infinity = orig.infinity;
this.intlCurrencySymbol = orig.intlCurrencySymbol;
+ this.monetarySeparator = orig.monetarySeparator;
this.minusSign = orig.minusSign;
this.NaN = orig.NaN;
this.patternSeparator = orig.patternSeparator;
@@ -107,6 +110,14 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
infinity = safeGetString (res, "infinity", "\u221e");
// FIXME: default?
intlCurrencySymbol = safeGetString (res, "intlCurrencySymbol", "$");
+ try
+ {
+ monetarySeparator = safeGetChar (res, "monetarySeparator", '.');
+ }
+ catch (MissingResourceException x)
+ {
+ monetarySeparator = decimalSeparator;
+ }
minusSign = safeGetChar (res, "minusSign", '-');
NaN = safeGetString (res, "NaN", "\ufffd");
patternSeparator = safeGetChar (res, "patternSeparator", ';');
@@ -128,6 +139,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
&& infinity.equals(dfs.infinity)
&& intlCurrencySymbol.equals(dfs.intlCurrencySymbol)
&& minusSign == dfs.minusSign
+ && monetarySeparator == dfs.monetarySeparator
&& NaN.equals(dfs.NaN)
&& patternSeparator == dfs.patternSeparator
&& percent == dfs.percent
@@ -176,6 +188,11 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
return minusSign;
}
+ public char getMonetaryDecimalSeparator ()
+ {
+ return monetarySeparator;
+ }
+
public String getNaN ()
{
return NaN;
@@ -250,6 +267,11 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
this.minusSign = minusSign;
}
+ public void setMonetaryDecimalSeparator (char decimalSep)
+ {
+ monetarySeparator = decimalSep;
+ }
+
public void setNaN (String nan)
{
NaN = nan;
@@ -285,9 +307,24 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
private String infinity;
private String intlCurrencySymbol;
private char minusSign;
+ private char monetarySeparator;
private String NaN;
private char patternSeparator;
private char percent;
private char perMill;
+ private int serialVersionOnStream = 1;
private char zeroDigit;
+ private static final long serialVersionUID = 5772796243397350300L;
+
+ private void readObject(ObjectInputStream stream)
+ throws IOException, ClassNotFoundException
+ {
+ stream.defaultReadObject();
+ if (serialVersionOnStream < 1)
+ {
+ monetarySeparator = decimalSeparator;
+ exponential = 'E';
+ serialVersionOnStream = 1;
+ }
+ }
}
diff --git a/libjava/java/text/NumberFormat.java b/libjava/java/text/NumberFormat.java
index 3a30010b073..f3f36e9c3df 100644
--- a/libjava/java/text/NumberFormat.java
+++ b/libjava/java/text/NumberFormat.java
@@ -11,6 +11,9 @@ package java.text;
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.MissingResourceException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.IOException;
/**
* @author Tom Tromey <tromey@cygnus.com>
@@ -18,8 +21,7 @@ import java.util.MissingResourceException;
*/
/* Written using "Java Class Libraries", 2nd edition, plus online
* API docs for JDK 1.2 from http://www.javasoft.com.
- * Status: Believed complete and correct to 1.2, except serialization
- * and getAvailableLocales.
+ * Status: Believed complete and correct to 1.2, except getAvailableLocales.
*/
public abstract class NumberFormat extends Format implements Cloneable
@@ -249,13 +251,44 @@ public abstract class NumberFormat extends Format implements Cloneable
}
// These field names are fixed by the serialization spec.
- // FIXME: serialization spec also mentions `byte' versions of the
- // min/max fields. We have no use for those, so for now they are
- // omitted.
protected boolean groupingUsed;
protected int maximumFractionDigits;
+ private byte maxFractionDigits;
protected int maximumIntegerDigits;
+ private byte maxIntegerDigits;
protected int minimumFractionDigits;
+ private byte minFractionDigits;
protected int minimumIntegerDigits;
+ private byte minIntegerDigits;
protected boolean parseIntegerOnly;
+ private int serialVersionOnStream;
+ private static final long serialVersionUID = -2308460125733713944L;
+
+ private void readObject(ObjectInputStream stream)
+ throws IOException, ClassNotFoundException
+ {
+ stream.defaultReadObject();
+ if (serialVersionOnStream < 1)
+ {
+ maximumFractionDigits = maxFractionDigits;
+ maximumIntegerDigits = maxIntegerDigits;
+ minimumFractionDigits = minFractionDigits;
+ minimumIntegerDigits = minIntegerDigits;
+ serialVersionOnStream = 1;
+ }
+ }
+
+ private void writeObject(ObjectOutputStream stream) throws IOException
+ {
+ maxFractionDigits = maximumFractionDigits < Byte.MAX_VALUE ?
+ (byte) maximumFractionDigits : Byte.MAX_VALUE;
+ maxIntegerDigits = maximumIntegerDigits < Byte.MAX_VALUE ?
+ (byte) maximumIntegerDigits : Byte.MAX_VALUE;
+ minFractionDigits = minimumFractionDigits < Byte.MAX_VALUE ?
+ (byte) minimumFractionDigits : Byte.MAX_VALUE;
+ minIntegerDigits = minimumIntegerDigits < Byte.MAX_VALUE ?
+ (byte) minimumIntegerDigits : Byte.MAX_VALUE;
+ serialVersionOnStream = 1;
+ stream.defaultWriteObject();
+ }
}
diff --git a/libjava/java/text/SimpleDateFormat.java b/libjava/java/text/SimpleDateFormat.java
index 08ed3175c56..feb64f0d02d 100644
--- a/libjava/java/text/SimpleDateFormat.java
+++ b/libjava/java/text/SimpleDateFormat.java
@@ -9,6 +9,8 @@ details. */
package java.text;
import java.util.*;
+import java.io.ObjectInputStream;
+import java.io.IOException;
/**
* @author Per Bothner <bothner@cygnus.com>
@@ -16,14 +18,29 @@ import java.util.*;
*/
/* Written using "Java Class Libraries", 2nd edition, plus online
* API docs for JDK 1.2 beta from http://www.javasoft.com.
- * Status: parse is not implemented.
+ * Status: Believed complete and correct to 1.2.
*/
public class SimpleDateFormat extends DateFormat
{
- private Date defaultCenturyStart;
+ // Serialization fields.
+ private Date defaultCenturyStart = new Date();
private DateFormatSymbols formatData;
private String pattern;
+ private int serialVersionOnStream = 1;
+ private static final long serialVersionUID = 4774881970558875024L;
+
+ // Serialization method.
+ private void readObject(ObjectInputStream stream)
+ throws IOException, ClassNotFoundException
+ {
+ stream.defaultReadObject();
+ if (serialVersionOnStream < 1)
+ {
+ defaultCenturyStart = new Date();
+ serialVersionOnStream = 1;
+ }
+ }
public SimpleDateFormat ()
{