This patch allows for FastDateFormat to be Serializable;
since the Rule objects stored as instance variables weren’t Serializable,
this would fail at runtime. -Nathan |
Index: src/java/org/apache/commons/lang/time/FastDateFormat.java =================================================================== --- src/java/org/apache/commons/lang/time/FastDateFormat.java (revision 230932) +++ src/java/org/apache/commons/lang/time/FastDateFormat.java (working copy) @@ -15,6 +15,7 @@ */ package org.apache.commons.lang.time; +import java.io.Serializable; import java.text.DateFormat; import java.text.DateFormatSymbols; import java.text.FieldPosition; @@ -64,6 +65,11 @@ * @version $Id$ */ public class FastDateFormat extends Format { + /** + * The serial version UID field. + */ + private static final long serialVersionUID = -7186497712641044641L; + // A lot of the speed in this class comes from caching, but some comes // from the special int to StringBuffer conversion. // @@ -1012,7 +1018,7 @@ /** * <p>Inner class defining a rule.</p> */ - private interface Rule { + private interface Rule extends Serializable { /** * Returns the estimated lentgh of the result. * @@ -1046,6 +1052,7 @@ * <p>Inner class to output a constant single character.</p> */ private static class CharacterLiteral implements Rule { + private static final long serialVersionUID = -3006038977583522370L; private final char mValue; /** @@ -1077,6 +1084,7 @@ * <p>Inner class to output a constant string.</p> */ private static class StringLiteral implements Rule { + private static final long serialVersionUID = -4237769618027438748L; private final String mValue; /** @@ -1108,6 +1116,7 @@ * <p>Inner class to output one of a set of values.</p> */ private static class TextField implements Rule { + private static final long serialVersionUID = 610343512968559251L; private final int mField; private final String[] mValues; @@ -1149,6 +1158,8 @@ * <p>Inner class to output an unpadded number.</p> */ private static class UnpaddedNumberField implements NumberRule { + private static final long serialVersionUID = -5478271746177817134L; + static final UnpaddedNumberField INSTANCE_YEAR = new UnpaddedNumberField(Calendar.YEAR); private final int mField; @@ -1195,6 +1206,7 @@ * <p>Inner class to output an unpadded month.</p> */ private static class UnpaddedMonthField implements NumberRule { + private static final long serialVersionUID = 6392283816011893718L; static final UnpaddedMonthField INSTANCE = new UnpaddedMonthField(); /** @@ -1236,6 +1248,7 @@ * <p>Inner class to output a padded number.</p> */ private static class PaddedNumberField implements NumberRule { + private static final long serialVersionUID = 2922130509399044362L; private final int mField; private final int mSize; @@ -1297,6 +1310,7 @@ * <p>Inner class to output a two digit number.</p> */ private static class TwoDigitNumberField implements NumberRule { + private static final long serialVersionUID = -366480877274976357L; private final int mField; /** @@ -1339,6 +1353,7 @@ * <p>Inner class to output a two digit year.</p> */ private static class TwoDigitYearField implements NumberRule { + private static final long serialVersionUID = -4977546665302522533L; static final TwoDigitYearField INSTANCE = new TwoDigitYearField(); /** @@ -1375,6 +1390,7 @@ * <p>Inner class to output a two digit month.</p> */ private static class TwoDigitMonthField implements NumberRule { + private static final long serialVersionUID = 2420864950549798674L; static final TwoDigitMonthField INSTANCE = new TwoDigitMonthField(); /** @@ -1411,6 +1427,7 @@ * <p>Inner class to output the twelve hour field.</p> */ private static class TwelveHourField implements NumberRule { + private static final long serialVersionUID = -3414426460602063658L; private final NumberRule mRule; /** @@ -1453,6 +1470,7 @@ * <p>Inner class to output the twenty four hour field.</p> */ private static class TwentyFourHourField implements NumberRule { + private static final long serialVersionUID = 9183263811338503048L; private final NumberRule mRule; /** @@ -1495,6 +1513,7 @@ * <p>Inner class to output a time zone name.</p> */ private static class TimeZoneNameRule implements Rule { + private static final long serialVersionUID = -8135009594144146229L; private final TimeZone mTimeZone; private final boolean mTimeZoneForced; private final Locale mLocale; @@ -1564,6 +1583,7 @@ * or <code>+/-HH:MM</code>.</p> */ private static class TimeZoneNumberRule implements Rule { + private static final long serialVersionUID = 5736697345268939594L; static final TimeZoneNumberRule INSTANCE_COLON = new TimeZoneNumberRule(true); static final TimeZoneNumberRule INSTANCE_NO_COLON = new TimeZoneNumberRule(false);
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]