jdk/src/share/classes/java/time/chrono/ThaiBuddhistChronology.java
changeset 19841 15c8e97d6a14
parent 19030 32f129cb6351
child 20794 ec823009c5f7
--- a/jdk/src/share/classes/java/time/chrono/ThaiBuddhistChronology.java	Fri Sep 06 14:18:06 2013 -0700
+++ b/jdk/src/share/classes/java/time/chrono/ThaiBuddhistChronology.java	Wed Sep 11 10:16:21 2013 -0400
@@ -56,6 +56,8 @@
  */
 package java.time.chrono;
 
+import java.io.InvalidObjectException;
+import java.io.ObjectStreamException;
 import static java.time.temporal.ChronoField.PROLEPTIC_MONTH;
 import static java.time.temporal.ChronoField.YEAR;
 
@@ -369,4 +371,29 @@
         return (ThaiBuddhistDate) super.resolveDate(fieldValues, resolverStyle);
     }
 
+    //-----------------------------------------------------------------------
+    /**
+     * Writes the Chronology using a
+     * <a href="../../../serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
+     * @serialData
+     * <pre>
+     *  out.writeByte(1);     // identifies a Chronology
+     *  out.writeUTF(getId());
+     * </pre>
+     *
+     * @return the instance of {@code Ser}, not null
+     */
+    @Override
+    Object writeReplace() {
+        return super.writeReplace();
+    }
+
+    /**
+     * Defend against malicious streams.
+     * @return never
+     * @throws InvalidObjectException always
+     */
+    private Object readResolve() throws InvalidObjectException {
+        throw new InvalidObjectException("Deserialization via serialization delegate");
+    }
 }