aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/util/Locale.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/java/util/Locale.java')
-rw-r--r--libjava/java/util/Locale.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/libjava/java/util/Locale.java b/libjava/java/util/Locale.java
index d2dc2f7..c9e1e2c 100644
--- a/libjava/java/util/Locale.java
+++ b/libjava/java/util/Locale.java
@@ -26,6 +26,7 @@ public final class Locale implements java.io.Serializable, Cloneable
private String language;
private String variant;
private static Locale defaultLocale;
+ private static final long serialVersionUID = 9149081749638150636L;
// These are as specified in the JDK 1.2 AP documentation
@@ -145,4 +146,28 @@ public final class Locale implements java.io.Serializable, Cloneable
}
return result.toString();
}
+
+ /**
+ * @serialdata According to jdk1.2 the hashcode should always be
+ * written as -1;
+ */
+ private void writeObject(java.io.ObjectOutputStream output)
+ throws java.io.IOException
+ {
+ int tmpHashcode = hashcode;
+ hashcode = -1;
+ output.defaultWriteObject();
+ hashcode = tmpHashcode;
+ }
+
+ /**
+ * @serialdata According to jdk1.2 the hashCode is always invalid
+ * and must be recomputed.
+ */
+ private void readObject(java.io.ObjectInputStream input)
+ throws java.io.IOException, ClassNotFoundException
+ {
+ input.defaultReadObject();
+ hashcode = language.hashCode() ^ country.hashCode() ^ variant.hashCode();
+ }
}