commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject svn commit: r490387 - in /jakarta/commons/proper/lang/trunk/src: java/org/apache/commons/lang/time/FastDateFormat.java test/org/apache/commons/lang/time/FastDateFormatTest.java
Date Tue, 26 Dec 2006 22:05:48 GMT
Author: bayard
Date: Tue Dec 26 14:05:47 2006
New Revision: 490387

URL: http://svn.apache.org/viewvc?view=rev&rev=490387
Log:
Applying test for #LANG-303, and a fix. 

Modified:
    jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/time/FastDateFormat.java
    jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/time/FastDateFormatTest.java

Modified: jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/time/FastDateFormat.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/time/FastDateFormat.java?view=diff&rev=490387&r1=490386&r2=490387
==============================================================================
--- jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/time/FastDateFormat.java
(original)
+++ jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/time/FastDateFormat.java
Tue Dec 26 14:05:47 2006
@@ -16,6 +16,9 @@
  */
 package org.apache.commons.lang.time;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+
 import java.text.DateFormat;
 import java.text.DateFormatSymbols;
 import java.text.FieldPosition;
@@ -134,11 +137,11 @@
     /**
      * The parsed rules.
      */
-    private Rule[] mRules;
+    private transient Rule[] mRules;
     /**
      * The estimated maximum length.
      */
-    private int mMaxLengthEstimate;
+    private transient int mMaxLengthEstimate;
 
     //-----------------------------------------------------------------------
     /**
@@ -1012,6 +1015,13 @@
      */
     public String toString() {
         return "FastDateFormat[" + mPattern + "]";
+    }
+
+    // Serializing
+    //-----------------------------------------------------------------------
+    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
+        in.defaultReadObject();
+        init();
     }
     
     // Rules

Modified: jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/time/FastDateFormatTest.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/time/FastDateFormatTest.java?view=diff&rev=490387&r1=490386&r2=490387
==============================================================================
--- jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/time/FastDateFormatTest.java
(original)
+++ jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/time/FastDateFormatTest.java
Tue Dec 26 14:05:47 2006
@@ -28,6 +28,8 @@
 import junit.framework.TestSuite;
 import junit.textui.TestRunner;
 
+import org.apache.commons.lang.SerializationUtils;
+
 /**
  * Unit tests {@link org.apache.commons.lang.time.FastDateFormat}.
  *
@@ -277,5 +279,10 @@
         assertEquals("0999/12/31", format.format(cal));
         cal.set(1,2,2);
         assertEquals("0001/03/02", format.format(cal));
+    }
+
+    public void testLang303() {
+        FastDateFormat format = FastDateFormat.getInstance("yyyy/MM/dd");
+        format = (FastDateFormat) SerializationUtils.deserialize( SerializationUtils.serialize(
format ) );
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message