Buggy code:
public class FastDateFormat extends Format { private static final long serialVersionUID = 1L ; public static final int FULL = DateFormat . FULL ; public static final int LONG = DateFormat . LONG ; public static final int MEDIUM = DateFormat . MEDIUM ; public static final int SHORT = DateFormat . SHORT ; private static String cDefaultPattern ; private static final Map < FastDateFormat , FastDateFormat > cInstanceCache = new HashMap < FastDateFormat , FastDateFormat > ( 7 ) ; private static final Map < Object , FastDateFormat > cDateInstanceCache = new HashMap < Object , FastDateFormat > ( 7 ) ; private static final Map < Object , FastDateFormat > cTimeInstanceCache = new HashMap < Object , FastDateFormat > ( 7 ) ; private static final Map < Object , FastDateFormat > cDateTimeInstanceCache = new HashMap < Object , FastDateFormat > ( 7 ) ; private static final Map < Object , String > cTimeZoneDisplayCache = new HashMap < Object , String > ( 7 ) ; private final String mPattern ; private final TimeZone mTimeZone ; private final boolean mTimeZoneForced ; private final Locale mLocale ; private final boolean mLocaleForced ; private transient FastDateFormat . Rule [ ] mRules ; private transient int mMaxLengthEstimate ; public static FastDateFormat getInstance ( ) { } public static FastDateFormat getInstance ( String pattern ) { } public static FastDateFormat getInstance ( String pattern , TimeZone timeZone ) { } public static FastDateFormat getInstance ( String pattern , Locale locale ) { } public static synchronized FastDateFormat getInstance ( String pattern , TimeZone timeZone , Locale locale ) { } public static FastDateFormat getDateInstance ( int style ) { } public static FastDateFormat getDateInstance ( int style , Locale locale ) { } public static FastDateFormat getDateInstance ( int style , TimeZone timeZone ) { } public static synchronized FastDateFormat getDateInstance ( int style , TimeZone timeZone , Locale locale ) { } public static FastDateFormat getTimeInstance ( int style ) { } public static FastDateFormat getTimeInstance ( int style , Locale locale ) { } public static FastDateFormat getTimeInstance ( int style , TimeZone timeZone ) { } public static synchronized FastDateFormat getTimeInstance ( int style , TimeZone timeZone , Locale locale ) { } public static FastDateFormat getDateTimeInstance ( int dateStyle , int timeStyle ) { } public static FastDateFormat getDateTimeInstance ( int dateStyle , int timeStyle , Locale locale ) { } public static FastDateFormat getDateTimeInstance ( int dateStyle , int timeStyle , TimeZone timeZone ) { } public static synchronized FastDateFormat getDateTimeInstance ( int dateStyle , int timeStyle , TimeZone timeZone , Locale locale ) { } static synchronized String getTimeZoneDisplay ( TimeZone tz , boolean daylight , int style , Locale locale ) { } private static synchronized String getDefaultPattern ( ) { } protected FastDateFormat ( String pattern , TimeZone timeZone , Locale locale ) { } protected void init ( ) { } protected List < FastDateFormat . Rule > parsePattern ( ) { } protected String parseToken ( String pattern , int [ ] indexRef ) { } protected FastDateFormat . NumberRule selectNumberRule ( int field , int padding ) { } @ Override public StringBuffer format ( Object obj , StringBuffer toAppendTo , FieldPosition pos ) { } public String format ( long millis ) { } public String format ( Date date ) { } public String format ( Calendar calendar ) { } public StringBuffer format ( long millis , StringBuffer buf ) { } public StringBuffer format ( Date date , StringBuffer buf ) { } public StringBuffer format ( Calendar calendar , StringBuffer buf ) { if ( mTimeZoneForced ) { <START_BUG> calendar . getTime ( ) ; <END_BUG> calendar = ( ( Calendar ) ( calendar . clone ( ) ) ) ; calendar . setTimeZone ( mTimeZone ) ; } return applyRules ( calendar , buf ) ; } protected StringBuffer applyRules ( Calendar calendar , StringBuffer buf ) { } @ Override public Object parseObject ( String source , ParsePosition pos ) { } public String getPattern ( ) { } public TimeZone getTimeZone ( ) { } public boolean getTimeZoneOverridesCalendar ( ) { } public Locale getLocale ( ) { } public int getMaxLengthEstimate ( ) { } @ Override public boolean equals ( Object obj ) { } @ Override public int hashCode ( ) { } @ Override public String toString ( ) { } private void readObject ( ObjectInputStream in ) throws IOException , ClassNotFoundException { } private interface Rule { int estimateLength ( ) { } void appendTo ( StringBuffer buffer , Calendar calendar ) { } } private interface NumberRule extends FastDateFormat . Rule { void appendTo ( StringBuffer buffer , int value ) { } } private static class CharacterLiteral implements FastDateFormat . Rule { private final char mValue ; CharacterLiteral ( char value ) { } public int estimateLength ( ) { } public void appendTo ( StringBuffer buffer , Calendar calendar ) { } } private static class StringLiteral implements FastDateFormat . Rule { private final String mValue ; StringLiteral ( String value ) { } public int estimateLength ( ) { } public void appendTo ( StringBuffer buffer , Calendar calendar ) { } } private static class TextField implements FastDateFormat . Rule { private final int mField ; private final String [ ] mValues ; TextField ( int field , String [ ] values ) { } public int estimateLength ( ) { } public void appendTo ( StringBuffer buffer , Calendar calendar ) { } } private static class UnpaddedNumberField implements FastDateFormat . NumberRule { private final int mField ; UnpaddedNumberField ( int field ) { } public int estimateLength ( ) { } public void appendTo ( StringBuffer buffer , Calendar calendar ) { } public final void appendTo ( StringBuffer buffer , int value ) { } }

Fix:
calendar . getTimeInMillis ( ) ;