You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rp...@apache.org on 2015/09/24 17:40:56 UTC

[1/2] logging-log4j2 git commit: Checkstyle

Repository: logging-log4j2
Updated Branches:
  refs/heads/master 457ea305a -> f0fca5c21


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/f0fca5c2/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FastDatePrinter.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FastDatePrinter.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FastDatePrinter.java
index 5bec64d..ef5a5dc 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FastDatePrinter.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FastDatePrinter.java
@@ -33,16 +33,15 @@ import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
 /**
- * Copied from Commons Lang 3
- *
+ * Copied from Commons Lang 3.
  */
 public class FastDatePrinter implements DatePrinter, Serializable {
     // A lot of the speed in this class comes from caching, but some comes
     // from the special int to StringBuilder conversion.
     //
     // The following produces a padded 2 digit number:
-    //   buffer.append((char)(value / 10 + '0'));
-    //   buffer.append((char)(value % 10 + '0'));
+    // buffer.append((char)(value / 10 + '0'));
+    // buffer.append((char)(value % 10 + '0'));
     //
     // Note that the fastest append to StringBuilder is a single char (used here).
     // Note that Integer.toString() is not called, the conversion is simply
@@ -50,13 +49,6 @@ public class FastDatePrinter implements DatePrinter, Serializable {
     // So, don't change this code! It works and is very fast.
 
     /**
-     * Required for serialization support.
-     *
-     * @see java.io.Serializable
-     */
-    private static final long serialVersionUID = 1L;
-
-    /**
      * FULL locale dependent date or time style.
      */
     public static final int FULL = DateFormat.FULL;
@@ -74,6 +66,13 @@ public class FastDatePrinter implements DatePrinter, Serializable {
     public static final int SHORT = DateFormat.SHORT;
 
     /**
+     * Required for serialization support.
+     *
+     * @see java.io.Serializable
+     */
+    private static final long serialVersionUID = 1L;
+
+    /**
      * The pattern.
      */
     private final String mPattern;
@@ -95,15 +94,17 @@ public class FastDatePrinter implements DatePrinter, Serializable {
     private transient int mMaxLengthEstimate;
 
     // Constructor
-    //-----------------------------------------------------------------------
+    // -----------------------------------------------------------------------
     /**
-     * <p>Constructs a new FastDatePrinter.</p>
-     * Use {@link FastDateFormat#getInstance(String, TimeZone, Locale)}  or another variation of the 
-     * factory methods of {@link FastDateFormat} to get a cached FastDatePrinter instance.
+     * <p>
+     * Constructs a new FastDatePrinter.
+     * </p>
+     * Use {@link FastDateFormat#getInstance(String, TimeZone, Locale)} or another variation of the factory methods of
+     * {@link FastDateFormat} to get a cached FastDatePrinter instance.
      *
-     * @param pattern  {@link java.text.SimpleDateFormat} compatible pattern
-     * @param timeZone  non-null time zone to use
-     * @param locale  non-null locale to use
+     * @param pattern {@link java.text.SimpleDateFormat} compatible pattern
+     * @param timeZone non-null time zone to use
+     * @param locale non-null locale to use
      * @throws NullPointerException if pattern, timeZone, or locale is null.
      */
     protected FastDatePrinter(final String pattern, final TimeZone timeZone, final Locale locale) {
@@ -115,14 +116,16 @@ public class FastDatePrinter implements DatePrinter, Serializable {
     }
 
     /**
-     * <p>Initializes the instance for first use.</p>
+     * <p>
+     * Initializes the instance for first use.
+     * </p>
      */
     private void init() {
         final List<Rule> rulesList = parsePattern();
         mRules = rulesList.toArray(new Rule[rulesList.size()]);
 
         int len = 0;
-        for (int i=mRules.length; --i >= 0; ) {
+        for (int i = mRules.length; --i >= 0;) {
             len += mRules[i].estimateLength();
         }
 
@@ -130,9 +133,11 @@ public class FastDatePrinter implements DatePrinter, Serializable {
     }
 
     // Parse the pattern
-    //-----------------------------------------------------------------------
+    // -----------------------------------------------------------------------
     /**
-     * <p>Returns a list of Rules given a pattern.</p>
+     * <p>
+     * Returns a list of Rules given a pattern.
+     * </p>
      *
      * @return a {@code List} of Rule objects
      * @throws IllegalArgumentException if pattern is invalid
@@ -228,9 +233,9 @@ public class FastDatePrinter implements DatePrinter, Serializable {
             case 'K': // hour in am/pm (0..11)
                 rule = selectNumberRule(Calendar.HOUR, tokenLen);
                 break;
-            case 'X': // ISO 8601 
+            case 'X': // ISO 8601
                 rule = Iso8601_Rule.getRule(tokenLen);
-                break;    
+                break;
             case 'z': // time zone (text)
                 if (tokenLen >= 4) {
                     rule = new TimeZoneNameRule(mTimeZone, mLocale, TimeZone.LONG);
@@ -266,10 +271,12 @@ public class FastDatePrinter implements DatePrinter, Serializable {
     }
 
     /**
-     * <p>Performs the parsing of tokens.</p>
+     * <p>
+     * Performs the parsing of tokens.
+     * </p>
      *
-     * @param pattern  the pattern
-     * @param indexRef  index references
+     * @param pattern the pattern
+     * @param indexRef index references
      * @return parsed token
      */
     protected String parseToken(final String pattern, final int[] indexRef) {
@@ -310,8 +317,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
                     } else {
                         inLiteral = !inLiteral;
                     }
-                } else if (!inLiteral &&
-                         (c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z')) {
+                } else if (!inLiteral && (c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z')) {
                     i--;
                     break;
                 } else {
@@ -325,10 +331,12 @@ public class FastDatePrinter implements DatePrinter, Serializable {
     }
 
     /**
-     * <p>Gets an appropriate rule for the padding required.</p>
+     * <p>
+     * Gets an appropriate rule for the padding required.
+     * </p>
      *
-     * @param field  the field to get a rule for
-     * @param padding  the padding required
+     * @param field the field to get a rule for
+     * @param padding the padding required
      * @return a new rule with the correct padding
      */
     protected NumberRule selectNumberRule(final int field, final int padding) {
@@ -343,14 +351,15 @@ public class FastDatePrinter implements DatePrinter, Serializable {
     }
 
     // Format methods
-    //-----------------------------------------------------------------------
+    // -----------------------------------------------------------------------
     /**
-     * <p>Formats a {@code Date}, {@code Calendar} or
-     * {@code Long} (milliseconds) object.</p>
+     * <p>
+     * Formats a {@code Date}, {@code Calendar} or {@code Long} (milliseconds) object.
+     * </p>
      *
-     * @param obj  the object to format
-     * @param toAppendTo  the buffer to append to
-     * @param pos  the position - ignored
+     * @param obj the object to format
+     * @param toAppendTo the buffer to append to
+     * @param pos the position - ignored
      * @return the buffer passed in
      */
     @Override
@@ -362,23 +371,25 @@ public class FastDatePrinter implements DatePrinter, Serializable {
         } else if (obj instanceof Long) {
             return format(((Long) obj).longValue(), toAppendTo);
         } else {
-            throw new IllegalArgumentException("Unknown class: " +
-                (obj == null ? "<null>" : obj.getClass().getName()));
+            throw new IllegalArgumentException("Unknown class: " + (obj == null ? "<null>" : obj.getClass().getName()));
         }
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see org.apache.commons.lang3.time.DatePrinter#format(long)
      */
     @Override
     public String format(final long millis) {
-        final Calendar c = newCalendar();  // hard code GregorianCalendar
+        final Calendar c = newCalendar(); // hard code GregorianCalendar
         c.setTimeInMillis(millis);
         return applyRulesToString(c);
     }
 
     /**
      * Creates a String representation of the given Calendar by applying the rules of this printer to it.
+     * 
      * @param c the Calender to apply the rules to.
      * @return a String representation of the given Calendar.
      */
@@ -388,6 +399,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
 
     /**
      * Creation method for ne calender instances.
+     * 
      * @return a new Calendar instance.
      */
     private GregorianCalendar newCalendar() {
@@ -395,17 +407,21 @@ public class FastDatePrinter implements DatePrinter, Serializable {
         return new GregorianCalendar(mTimeZone, mLocale);
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see org.apache.commons.lang3.time.DatePrinter#format(java.util.Date)
      */
     @Override
     public String format(final Date date) {
-        final Calendar c = newCalendar();  // hard code GregorianCalendar
+        final Calendar c = newCalendar(); // hard code GregorianCalendar
         c.setTime(date);
         return applyRulesToString(c);
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see org.apache.commons.lang3.time.DatePrinter#format(java.util.Calendar)
      */
     @Override
@@ -413,7 +429,9 @@ public class FastDatePrinter implements DatePrinter, Serializable {
         return format(calendar, new StringBuilder(mMaxLengthEstimate)).toString();
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see org.apache.commons.lang3.time.DatePrinter#format(long, java.lang.StringBuilder)
      */
     @Override
@@ -421,17 +439,21 @@ public class FastDatePrinter implements DatePrinter, Serializable {
         return format(new Date(millis), buf);
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see org.apache.commons.lang3.time.DatePrinter#format(java.util.Date, java.lang.StringBuilder)
      */
     @Override
     public StringBuilder format(final Date date, final StringBuilder buf) {
-        final Calendar c = newCalendar();  // hard code GregorianCalendar
+        final Calendar c = newCalendar(); // hard code GregorianCalendar
         c.setTime(date);
         return applyRules(c, buf);
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see org.apache.commons.lang3.time.DatePrinter#format(java.util.Calendar, java.lang.StringBuilder)
      */
     @Override
@@ -441,11 +463,12 @@ public class FastDatePrinter implements DatePrinter, Serializable {
     }
 
     /**
-     * <p>Performs the formatting by applying the rules to the
-     * specified calendar.</p>
+     * <p>
+     * Performs the formatting by applying the rules to the specified calendar.
+     * </p>
      *
-     * @param calendar  the calendar to format
-     * @param buf  the buffer to format into
+     * @param calendar the calendar to format
+     * @param buf the buffer to format into
      * @return the specified string buffer
      */
     protected StringBuilder applyRules(final Calendar calendar, final StringBuilder buf) {
@@ -456,8 +479,10 @@ public class FastDatePrinter implements DatePrinter, Serializable {
     }
 
     // Accessors
-    //-----------------------------------------------------------------------
-    /* (non-Javadoc)
+    // -----------------------------------------------------------------------
+    /*
+     * (non-Javadoc)
+     * 
      * @see org.apache.commons.lang3.time.DatePrinter#getPattern()
      */
     @Override
@@ -465,7 +490,9 @@ public class FastDatePrinter implements DatePrinter, Serializable {
         return mPattern;
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see org.apache.commons.lang3.time.DatePrinter#getTimeZone()
      */
     @Override
@@ -473,7 +500,9 @@ public class FastDatePrinter implements DatePrinter, Serializable {
         return mTimeZone;
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see org.apache.commons.lang3.time.DatePrinter#getLocale()
      */
     @Override
@@ -482,11 +511,13 @@ public class FastDatePrinter implements DatePrinter, Serializable {
     }
 
     /**
-     * <p>Gets an estimate for the maximum string length that the
-     * formatter will produce.</p>
+     * <p>
+     * Gets an estimate for the maximum string length that the formatter will produce.
+     * </p>
      *
-     * <p>The actual formatted length will almost always be less than or
-     * equal to this amount.</p>
+     * <p>
+     * The actual formatted length will almost always be less than or equal to this amount.
+     * </p>
      *
      * @return the maximum formatted length
      */
@@ -495,11 +526,13 @@ public class FastDatePrinter implements DatePrinter, Serializable {
     }
 
     // Basics
-    //-----------------------------------------------------------------------
+    // -----------------------------------------------------------------------
     /**
-     * <p>Compares two objects for equality.</p>
+     * <p>
+     * Compares two objects for equality.
+     * </p>
      *
-     * @param obj  the object to compare to
+     * @param obj the object to compare to
      * @return {@code true} if equal
      */
     @Override
@@ -508,13 +541,13 @@ public class FastDatePrinter implements DatePrinter, Serializable {
             return false;
         }
         final FastDatePrinter other = (FastDatePrinter) obj;
-        return mPattern.equals(other.mPattern)
-            && mTimeZone.equals(other.mTimeZone) 
-            && mLocale.equals(other.mLocale);
+        return mPattern.equals(other.mPattern) && mTimeZone.equals(other.mTimeZone) && mLocale.equals(other.mLocale);
     }
 
     /**
-     * <p>Returns a hashcode compatible with equals.</p>
+     * <p>
+     * Returns a hashcode compatible with equals.
+     * </p>
      *
      * @return a hashcode compatible with equals
      */
@@ -524,7 +557,9 @@ public class FastDatePrinter implements DatePrinter, Serializable {
     }
 
     /**
-     * <p>Gets a debugging string version of this formatter.</p>
+     * <p>
+     * Gets a debugging string version of this formatter.
+     * </p>
      *
      * @return a debugging string
      */
@@ -534,10 +569,9 @@ public class FastDatePrinter implements DatePrinter, Serializable {
     }
 
     // Serializing
-    //-----------------------------------------------------------------------
+    // -----------------------------------------------------------------------
     /**
-     * Create the object after serialization. This implementation reinitializes the
-     * transient properties.
+     * Create the object after serialization. This implementation reinitializes the transient properties.
      *
      * @param in ObjectInputStream from which the object is being deserialized.
      * @throws IOException if there is an IO issue.
@@ -555,14 +589,16 @@ public class FastDatePrinter implements DatePrinter, Serializable {
      * @param value the value to append digits from.
      */
     private static void appendDigits(final StringBuilder buffer, final int value) {
-        buffer.append((char)(value / 10 + '0'));
-        buffer.append((char)(value % 10 + '0'));
+        buffer.append((char) (value / 10 + '0'));
+        buffer.append((char) (value % 10 + '0'));
     }
 
     // Rules
-    //-----------------------------------------------------------------------
+    // -----------------------------------------------------------------------
     /**
-     * <p>Inner class defining a rule.</p>
+     * <p>
+     * Inner class defining a rule.
+     * </p>
      */
     private interface Rule {
         /**
@@ -582,7 +618,9 @@ public class FastDatePrinter implements DatePrinter, Serializable {
     }
 
     /**
-     * <p>Inner class defining a numeric rule.</p>
+     * <p>
+     * Inner class defining a numeric rule.
+     * </p>
      */
     private interface NumberRule extends Rule {
         /**
@@ -595,14 +633,15 @@ public class FastDatePrinter implements DatePrinter, Serializable {
     }
 
     /**
-     * <p>Inner class to output a constant single character.</p>
+     * <p>
+     * Inner class to output a constant single character.
+     * </p>
      */
     private static class CharacterLiteral implements Rule {
         private final char mValue;
 
         /**
-         * Constructs a new instance of {@code CharacterLiteral}
-         * to hold the specified value.
+         * Constructs a new instance of {@code CharacterLiteral} to hold the specified value.
          *
          * @param value the character literal
          */
@@ -628,14 +667,15 @@ public class FastDatePrinter implements DatePrinter, Serializable {
     }
 
     /**
-     * <p>Inner class to output a constant string.</p>
+     * <p>
+     * Inner class to output a constant string.
+     * </p>
      */
     private static class StringLiteral implements Rule {
         private final String mValue;
 
         /**
-         * Constructs a new instance of {@code StringLiteral}
-         * to hold the specified value.
+         * Constructs a new instance of {@code StringLiteral} to hold the specified value.
          *
          * @param value the string literal
          */
@@ -661,15 +701,16 @@ public class FastDatePrinter implements DatePrinter, Serializable {
     }
 
     /**
-     * <p>Inner class to output one of a set of values.</p>
+     * <p>
+     * Inner class to output one of a set of values.
+     * </p>
      */
     private static class TextField implements Rule {
         private final int mField;
         private final String[] mValues;
 
         /**
-         * Constructs an instance of {@code TextField}
-         * with the specified field and values.
+         * Constructs an instance of {@code TextField} with the specified field and values.
          *
          * @param field the field
          * @param values the field values
@@ -685,7 +726,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
         @Override
         public int estimateLength() {
             int max = 0;
-            for (int i=mValues.length; --i >= 0; ) {
+            for (int i = mValues.length; --i >= 0;) {
                 final int len = mValues[i].length();
                 if (len > max) {
                     max = len;
@@ -704,7 +745,9 @@ public class FastDatePrinter implements DatePrinter, Serializable {
     }
 
     /**
-     * <p>Inner class to output an unpadded number.</p>
+     * <p>
+     * Inner class to output an unpadded number.
+     * </p>
      */
     private static class UnpaddedNumberField implements NumberRule {
         private final int mField;
@@ -740,7 +783,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
         @Override
         public final void appendTo(final StringBuilder buffer, final int value) {
             if (value < 10) {
-                buffer.append((char)(value + '0'));
+                buffer.append((char) (value + '0'));
             } else if (value < 100) {
                 appendDigits(buffer, value);
             } else {
@@ -750,7 +793,9 @@ public class FastDatePrinter implements DatePrinter, Serializable {
     }
 
     /**
-     * <p>Inner class to output an unpadded month.</p>
+     * <p>
+     * Inner class to output an unpadded month.
+     * </p>
      */
     private static class UnpaddedMonthField implements NumberRule {
         static final UnpaddedMonthField INSTANCE = new UnpaddedMonthField();
@@ -785,7 +830,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
         @Override
         public final void appendTo(final StringBuilder buffer, final int value) {
             if (value < 10) {
-                buffer.append((char)(value + '0'));
+                buffer.append((char) (value + '0'));
             } else {
                 appendDigits(buffer, value);
             }
@@ -793,7 +838,9 @@ public class FastDatePrinter implements DatePrinter, Serializable {
     }
 
     /**
-     * <p>Inner class to output a padded number.</p>
+     * <p>
+     * Inner class to output a padded number.
+     * </p>
      */
     private static class PaddedNumberField implements NumberRule {
         private final int mField;
@@ -836,19 +883,21 @@ public class FastDatePrinter implements DatePrinter, Serializable {
         @Override
         public final void appendTo(final StringBuilder buffer, int value) {
             // pad the buffer with adequate zeros
-            for(int digit = 0; digit<mSize; ++digit) {
-                buffer.append('0');                
+            for (int digit = 0; digit < mSize; ++digit) {
+                buffer.append('0');
             }
             // backfill the buffer with non-zero digits
             int index = buffer.length();
-            for( ; value>0; value /= 10) {
-                buffer.setCharAt(--index, (char)('0' + value % 10));
+            for (; value > 0; value /= 10) {
+                buffer.setCharAt(--index, (char) ('0' + value % 10));
             }
         }
     }
 
     /**
-     * <p>Inner class to output a two digit number.</p>
+     * <p>
+     * Inner class to output a two digit number.
+     * </p>
      */
     private static class TwoDigitNumberField implements NumberRule {
         private final int mField;
@@ -892,7 +941,9 @@ public class FastDatePrinter implements DatePrinter, Serializable {
     }
 
     /**
-     * <p>Inner class to output a two digit year.</p>
+     * <p>
+     * Inner class to output a two digit year.
+     * </p>
      */
     private static class TwoDigitYearField implements NumberRule {
         static final TwoDigitYearField INSTANCE = new TwoDigitYearField();
@@ -930,7 +981,9 @@ public class FastDatePrinter implements DatePrinter, Serializable {
     }
 
     /**
-     * <p>Inner class to output a two digit month.</p>
+     * <p>
+     * Inner class to output a two digit month.
+     * </p>
      */
     private static class TwoDigitMonthField implements NumberRule {
         static final TwoDigitMonthField INSTANCE = new TwoDigitMonthField();
@@ -968,14 +1021,15 @@ public class FastDatePrinter implements DatePrinter, Serializable {
     }
 
     /**
-     * <p>Inner class to output the twelve hour field.</p>
+     * <p>
+     * Inner class to output the twelve hour field.
+     * </p>
      */
     private static class TwelveHourField implements NumberRule {
         private final NumberRule mRule;
 
         /**
-         * Constructs an instance of {@code TwelveHourField} with the specified
-         * {@code NumberRule}.
+         * Constructs an instance of {@code TwelveHourField} with the specified {@code NumberRule}.
          *
          * @param rule the rule
          */
@@ -1013,14 +1067,15 @@ public class FastDatePrinter implements DatePrinter, Serializable {
     }
 
     /**
-     * <p>Inner class to output the twenty four hour field.</p>
+     * <p>
+     * Inner class to output the twenty four hour field.
+     * </p>
      */
     private static class TwentyFourHourField implements NumberRule {
         private final NumberRule mRule;
 
         /**
-         * Constructs an instance of {@code TwentyFourHourField} with the specified
-         * {@code NumberRule}.
+         * Constructs an instance of {@code TwentyFourHourField} with the specified {@code NumberRule}.
          *
          * @param rule the rule
          */
@@ -1057,17 +1112,20 @@ public class FastDatePrinter implements DatePrinter, Serializable {
         }
     }
 
-    //-----------------------------------------------------------------------
+    // -----------------------------------------------------------------------
+
+    private static final ConcurrentMap<TimeZoneDisplayKey, String> cTimeZoneDisplayCache = new ConcurrentHashMap<TimeZoneDisplayKey, String>(
+            7);
 
-    private static final ConcurrentMap<TimeZoneDisplayKey, String> cTimeZoneDisplayCache =
-        new ConcurrentHashMap<TimeZoneDisplayKey, String>(7);
     /**
-     * <p>Gets the time zone display name, using a cache for performance.</p>
+     * <p>
+     * Gets the time zone display name, using a cache for performance.
+     * </p>
      *
-     * @param tz  the zone to query
-     * @param daylight  true if daylight savings
-     * @param style  the style to use {@code TimeZone.LONG} or {@code TimeZone.SHORT}
-     * @param locale  the locale to use
+     * @param tz the zone to query
+     * @param daylight true if daylight savings
+     * @param style the style to use {@code TimeZone.LONG} or {@code TimeZone.SHORT}
+     * @param locale the locale to use
      * @return the textual name of the time zone
      */
     static String getTimeZoneDisplay(final TimeZone tz, final boolean daylight, final int style, final Locale locale) {
@@ -1078,14 +1136,16 @@ public class FastDatePrinter implements DatePrinter, Serializable {
             value = tz.getDisplayName(daylight, style, locale);
             final String prior = cTimeZoneDisplayCache.putIfAbsent(key, value);
             if (prior != null) {
-                value= prior;
+                value = prior;
             }
         }
         return value;
     }
 
     /**
-     * <p>Inner class to output a time zone name.</p>
+     * <p>
+     * Inner class to output a time zone name.
+     * </p>
      */
     private static class TimeZoneNameRule implements Rule {
         private final Locale mLocale;
@@ -1103,7 +1163,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
         TimeZoneNameRule(final TimeZone timeZone, final Locale locale, final int style) {
             mLocale = locale;
             mStyle = style;
-            
+
             mStandard = getTimeZoneDisplay(timeZone, false, style, locale);
             mDaylight = getTimeZoneDisplay(timeZone, true, style, locale);
         }
@@ -1134,13 +1194,14 @@ public class FastDatePrinter implements DatePrinter, Serializable {
     }
 
     /**
-     * <p>Inner class to output a time zone as a number {@code +/-HHMM}
-     * or {@code +/-HH:MM}.</p>
+     * <p>
+     * Inner class to output a time zone as a number {@code +/-HHMM} or {@code +/-HH:MM}.
+     * </p>
      */
     private static class TimeZoneNumberRule implements Rule {
         static final TimeZoneNumberRule INSTANCE_COLON = new TimeZoneNumberRule(true);
         static final TimeZoneNumberRule INSTANCE_NO_COLON = new TimeZoneNumberRule(false);
-        
+
         final boolean mColon;
 
         /**
@@ -1165,7 +1226,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
          */
         @Override
         public void appendTo(final StringBuilder buffer, final Calendar calendar) {
-            
+
             int offset = calendar.get(Calendar.ZONE_OFFSET) + calendar.get(Calendar.DST_OFFSET);
 
             if (offset < 0) {
@@ -1188,13 +1249,14 @@ public class FastDatePrinter implements DatePrinter, Serializable {
     }
 
     /**
-     * <p>Inner class to output a time zone as a number {@code +/-HHMM}
-     * or {@code +/-HH:MM}.</p>
+     * <p>
+     * Inner class to output a time zone as a number {@code +/-HHMM} or {@code +/-HH:MM}.
+     * </p>
      */
     private static class Iso8601_Rule implements Rule {
-        
+
         // Sign TwoDigitHours or Z
-        static final Iso8601_Rule ISO8601_HOURS = new Iso8601_Rule(3);       
+        static final Iso8601_Rule ISO8601_HOURS = new Iso8601_Rule(3);
         // Sign TwoDigitHours Minutes or Z
         static final Iso8601_Rule ISO8601_HOURS_MINUTES = new Iso8601_Rule(5);
         // Sign TwoDigitHours : Minutes or Z
@@ -1204,11 +1266,11 @@ public class FastDatePrinter implements DatePrinter, Serializable {
          * Factory method for Iso8601_Rules.
          *
          * @param tokenLen a token indicating the length of the TimeZone String to be formatted.
-         * @return a Iso8601_Rule that can format TimeZone String of length {@code tokenLen}. If no such
-         *          rule exists, an IllegalArgumentException will be thrown.
+         * @return a Iso8601_Rule that can format TimeZone String of length {@code tokenLen}. If no such rule exists, an
+         *         IllegalArgumentException will be thrown.
          */
         static Iso8601_Rule getRule(final int tokenLen) {
-            switch(tokenLen) {
+            switch (tokenLen) {
             case 1:
                 return Iso8601_Rule.ISO8601_HOURS;
             case 2:
@@ -1216,10 +1278,10 @@ public class FastDatePrinter implements DatePrinter, Serializable {
             case 3:
                 return Iso8601_Rule.ISO8601_HOURS_COLON_MINUTES;
             default:
-                throw new IllegalArgumentException("invalid number of X");                    
+                throw new IllegalArgumentException("invalid number of X");
             }
-        }        
-        
+        }
+
         final int length;
 
         /**
@@ -1249,7 +1311,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
                 buffer.append("Z");
                 return;
             }
-            
+
             if (offset < 0) {
                 buffer.append('-');
                 offset = -offset;
@@ -1260,11 +1322,11 @@ public class FastDatePrinter implements DatePrinter, Serializable {
             final int hours = offset / (60 * 60 * 1000);
             appendDigits(buffer, hours);
 
-            if (length<5) {
+            if (length < 5) {
                 return;
             }
-            
-            if (length==6) {
+
+            if (length == 6) {
                 buffer.append(':');
             }
 
@@ -1275,7 +1337,9 @@ public class FastDatePrinter implements DatePrinter, Serializable {
 
     // ----------------------------------------------------------------------
     /**
-     * <p>Inner class that acts as a compound key for time zone names.</p>
+     * <p>
+     * Inner class that acts as a compound key for time zone names.
+     * </p>
      */
     private static class TimeZoneDisplayKey {
         private final TimeZone mTimeZone;
@@ -1290,8 +1354,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
          * @param style the timezone style
          * @param locale the timezone locale
          */
-        TimeZoneDisplayKey(final TimeZone timeZone,
-                           final boolean daylight, final int style, final Locale locale) {
+        TimeZoneDisplayKey(final TimeZone timeZone, final boolean daylight, final int style, final Locale locale) {
             mTimeZone = timeZone;
             if (daylight) {
                 mStyle = style | 0x80000000;
@@ -1306,7 +1369,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
          */
         @Override
         public int hashCode() {
-            return (mStyle * 31 + mLocale.hashCode() ) * 31 + mTimeZone.hashCode();
+            return (mStyle * 31 + mLocale.hashCode()) * 31 + mTimeZone.hashCode();
         }
 
         /**
@@ -1318,11 +1381,8 @@ public class FastDatePrinter implements DatePrinter, Serializable {
                 return true;
             }
             if (obj instanceof TimeZoneDisplayKey) {
-                final TimeZoneDisplayKey other = (TimeZoneDisplayKey)obj;
-                return
-                    mTimeZone.equals(other.mTimeZone) &&
-                    mStyle == other.mStyle &&
-                    mLocale.equals(other.mLocale);
+                final TimeZoneDisplayKey other = (TimeZoneDisplayKey) obj;
+                return mTimeZone.equals(other.mTimeZone) && mStyle == other.mStyle && mLocale.equals(other.mLocale);
             }
             return false;
         }

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/f0fca5c2/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FixedDateFormat.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FixedDateFormat.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FixedDateFormat.java
index ff45602..e8612b3 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FixedDateFormat.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FixedDateFormat.java
@@ -77,7 +77,7 @@ public class FixedDateFormat {
         /**
          * ISO8601 time format: {@code "yyyy-MM-dd'T'HH:mm:ss,SSS"}.
          */
-        ISO8601("yyyy-MM-dd'T'HH:mm:ss,SSS", "yyyy-MM-dd'T'", 2, ':', 1, ',', 1), ;
+        ISO8601("yyyy-MM-dd'T'HH:mm:ss,SSS", "yyyy-MM-dd'T'", 2, ':', 1, ',', 1);
 
         private final String pattern;
         private final String datePattern;
@@ -108,6 +108,9 @@ public class FixedDateFormat {
 
         /**
          * Returns the FixedFormat with the name or pattern matching the specified string or {@code null} if not found.
+         * 
+         * @param nameOrPattern the name or pattern to find a FixedFormat for
+         * @return the FixedFormat with the name or pattern matching the specified string
          */
         public static FixedFormat lookup(final String nameOrPattern) {
             for (final FixedFormat type : FixedFormat.values()) {
@@ -131,21 +134,6 @@ public class FixedDateFormat {
         }
     }
 
-    public static FixedDateFormat createIfSupported(final String... options) {
-        if (options == null || options.length == 0 || options[0] == null) {
-            return new FixedDateFormat(FixedFormat.DEFAULT);
-        }
-        if (options.length > 1) {
-            return null; // time zone not supported
-        }
-        final FixedFormat type = FixedFormat.lookup(options[0]);
-        return type == null ? null : new FixedDateFormat(type);
-    }
-
-    public static FixedDateFormat create(FixedFormat format) {
-        return new FixedDateFormat(format);
-    }
-
     private final FixedFormat fixedFormat;
     private final int length;
     private final int dateLength;
@@ -183,6 +171,21 @@ public class FixedDateFormat {
         this.fastDateFormat = fixedFormat.getFastDateFormat();
     }
 
+    public static FixedDateFormat createIfSupported(final String... options) {
+        if (options == null || options.length == 0 || options[0] == null) {
+            return new FixedDateFormat(FixedFormat.DEFAULT);
+        }
+        if (options.length > 1) {
+            return null; // time zone not supported
+        }
+        final FixedFormat type = FixedFormat.lookup(options[0]);
+        return type == null ? null : new FixedDateFormat(type);
+    }
+
+    public static FixedDateFormat create(FixedFormat format) {
+        return new FixedDateFormat(format);
+    }
+
     public String getFormat() {
         return fixedFormat.getPattern();
     }

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/f0fca5c2/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FormatCache.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FormatCache.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FormatCache.java
index 91ddaf1..0c94220 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FormatCache.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FormatCache.java
@@ -26,26 +26,28 @@ import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
 /**
- * <p>FormatCache is a cache and factory for {@link Format}s.</p>
+ * <p>
+ * FormatCache is a cache and factory for {@link Format}s.
+ * </p>
  *
  * @since 3.0
  */
 // TODO: Before making public move from getDateTimeInstance(Integer,...) to int; or some other approach.
 abstract class FormatCache<F extends Format> {
     /**
-     * No date or no time.  Used in same parameters as DateFormat.SHORT or DateFormat.LONG
+     * No date or no time. Used in same parameters as DateFormat.SHORT or DateFormat.LONG
      */
-    static final int NONE= -1;
+    static final int NONE = -1;
 
-    private final ConcurrentMap<MultipartKey, F> cInstanceCache
-            = new ConcurrentHashMap<MultipartKey, F>(7);
+    private static final ConcurrentMap<MultipartKey, String> DATETIME_INSTANCE_CACHE =
+            new ConcurrentHashMap<MultipartKey, String>(7);
 
-    private static final ConcurrentMap<MultipartKey, String> cDateTimeInstanceCache
-            = new ConcurrentHashMap<MultipartKey, String>(7);
+    private final ConcurrentMap<MultipartKey, F> cInstanceCache = new ConcurrentHashMap<MultipartKey, F>(7);
 
     /**
-     * <p>Gets a formatter instance using the default pattern in the
-     * default timezone and locale.</p>
+     * <p>
+     * Gets a formatter instance using the default pattern in the default timezone and locale.
+     * </p>
      *
      * @return a date/time formatter
      */
@@ -54,16 +56,15 @@ abstract class FormatCache<F extends Format> {
     }
 
     /**
-     * <p>Gets a formatter instance using the specified pattern, time zone
-     * and locale.</p>
+     * <p>
+     * Gets a formatter instance using the specified pattern, time zone and locale.
+     * </p>
      *
-     * @param pattern  {@link java.text.SimpleDateFormat} compatible
-     *  pattern, non-null
-     * @param timeZone  the time zone, null means use the default TimeZone
-     * @param locale  the locale, null means use the default Locale
+     * @param pattern {@link java.text.SimpleDateFormat} compatible pattern, non-null
+     * @param timeZone the time zone, null means use the default TimeZone
+     * @param locale the locale, null means use the default Locale
      * @return a pattern based date/time formatter
-     * @throws IllegalArgumentException if pattern is invalid
-     *  or <code>null</code>
+     * @throws IllegalArgumentException if pattern is invalid or <code>null</code>
      */
     public F getInstance(final String pattern, TimeZone timeZone, Locale locale) {
         if (pattern == null) {
@@ -79,44 +80,44 @@ abstract class FormatCache<F extends Format> {
         F format = cInstanceCache.get(key);
         if (format == null) {
             format = createInstance(pattern, timeZone, locale);
-            final F previousValue= cInstanceCache.putIfAbsent(key, format);
+            final F previousValue = cInstanceCache.putIfAbsent(key, format);
             if (previousValue != null) {
                 // another thread snuck in and did the same work
                 // we should return the instance that is in ConcurrentMap
-                format= previousValue;
+                format = previousValue;
             }
         }
         return format;
     }
 
     /**
-     * <p>Create a format instance using the specified pattern, time zone
-     * and locale.</p>
+     * <p>
+     * Create a format instance using the specified pattern, time zone and locale.
+     * </p>
      *
-     * @param pattern  {@link java.text.SimpleDateFormat} compatible pattern, this will not be null.
-     * @param timeZone  time zone, this will not be null.
-     * @param locale  locale, this will not be null.
+     * @param pattern {@link java.text.SimpleDateFormat} compatible pattern, this will not be null.
+     * @param timeZone time zone, this will not be null.
+     * @param locale locale, this will not be null.
      * @return a pattern based date/time formatter
-     * @throws IllegalArgumentException if pattern is invalid
-     *  or <code>null</code>
+     * @throws IllegalArgumentException if pattern is invalid or <code>null</code>
      */
     abstract protected F createInstance(String pattern, TimeZone timeZone, Locale locale);
 
     /**
-     * <p>Gets a date/time formatter instance using the specified style,
-     * time zone and locale.</p>
+     * <p>
+     * Gets a date/time formatter instance using the specified style, time zone and locale.
+     * </p>
      *
-     * @param dateStyle  date style: FULL, LONG, MEDIUM, or SHORT, null indicates no date in format
-     * @param timeStyle  time style: FULL, LONG, MEDIUM, or SHORT, null indicates no time in format
-     * @param timeZone  optional time zone, overrides time zone of
-     *  formatted date, null means use default Locale
-     * @param locale  optional locale, overrides system locale
+     * @param dateStyle date style: FULL, LONG, MEDIUM, or SHORT, null indicates no date in format
+     * @param timeStyle time style: FULL, LONG, MEDIUM, or SHORT, null indicates no time in format
+     * @param timeZone optional time zone, overrides time zone of formatted date, null means use default Locale
+     * @param locale optional locale, overrides system locale
      * @return a localized standard date/time formatter
-     * @throws IllegalArgumentException if the Locale has no date/time
-     *  pattern defined
+     * @throws IllegalArgumentException if the Locale has no date/time pattern defined
      */
     // This must remain private, see LANG-884
-    private F getDateTimeInstance(final Integer dateStyle, final Integer timeStyle, final TimeZone timeZone, Locale locale) {
+    private F getDateTimeInstance(final Integer dateStyle, final Integer timeStyle, final TimeZone timeZone,
+            Locale locale) {
         if (locale == null) {
             locale = Locale.getDefault();
         }
@@ -125,17 +126,16 @@ abstract class FormatCache<F extends Format> {
     }
 
     /**
-     * <p>Gets a date/time formatter instance using the specified style,
-     * time zone and locale.</p>
+     * <p>
+     * Gets a date/time formatter instance using the specified style, time zone and locale.
+     * </p>
      *
-     * @param dateStyle  date style: FULL, LONG, MEDIUM, or SHORT
-     * @param timeStyle  time style: FULL, LONG, MEDIUM, or SHORT
-     * @param timeZone  optional time zone, overrides time zone of
-     *  formatted date, null means use default Locale
-     * @param locale  optional locale, overrides system locale
+     * @param dateStyle date style: FULL, LONG, MEDIUM, or SHORT
+     * @param timeStyle time style: FULL, LONG, MEDIUM, or SHORT
+     * @param timeZone optional time zone, overrides time zone of formatted date, null means use default Locale
+     * @param locale optional locale, overrides system locale
      * @return a localized standard date/time formatter
-     * @throws IllegalArgumentException if the Locale has no date/time
-     *  pattern defined
+     * @throws IllegalArgumentException if the Locale has no date/time pattern defined
      */
     // package protected, for access from FastDateFormat; do not make public or protected
     F getDateTimeInstance(final int dateStyle, final int timeStyle, final TimeZone timeZone, final Locale locale) {
@@ -143,16 +143,15 @@ abstract class FormatCache<F extends Format> {
     }
 
     /**
-     * <p>Gets a date formatter instance using the specified style,
-     * time zone and locale.</p>
+     * <p>
+     * Gets a date formatter instance using the specified style, time zone and locale.
+     * </p>
      *
-     * @param dateStyle  date style: FULL, LONG, MEDIUM, or SHORT
-     * @param timeZone  optional time zone, overrides time zone of
-     *  formatted date, null means use default Locale
-     * @param locale  optional locale, overrides system locale
+     * @param dateStyle date style: FULL, LONG, MEDIUM, or SHORT
+     * @param timeZone optional time zone, overrides time zone of formatted date, null means use default Locale
+     * @param locale optional locale, overrides system locale
      * @return a localized standard date/time formatter
-     * @throws IllegalArgumentException if the Locale has no date/time
-     *  pattern defined
+     * @throws IllegalArgumentException if the Locale has no date/time pattern defined
      */
     // package protected, for access from FastDateFormat; do not make public or protected
     F getDateInstance(final int dateStyle, final TimeZone timeZone, final Locale locale) {
@@ -160,16 +159,15 @@ abstract class FormatCache<F extends Format> {
     }
 
     /**
-     * <p>Gets a time formatter instance using the specified style,
-     * time zone and locale.</p>
+     * <p>
+     * Gets a time formatter instance using the specified style, time zone and locale.
+     * </p>
      *
-     * @param timeStyle  time style: FULL, LONG, MEDIUM, or SHORT
-     * @param timeZone  optional time zone, overrides time zone of
-     *  formatted date, null means use default Locale
-     * @param locale  optional locale, overrides system locale
+     * @param timeStyle time style: FULL, LONG, MEDIUM, or SHORT
+     * @param timeZone optional time zone, overrides time zone of formatted date, null means use default Locale
+     * @param locale optional locale, overrides system locale
      * @return a localized standard date/time formatter
-     * @throws IllegalArgumentException if the Locale has no date/time
-     *  pattern defined
+     * @throws IllegalArgumentException if the Locale has no date/time pattern defined
      */
     // package protected, for access from FastDateFormat; do not make public or protected
     F getTimeInstance(final int timeStyle, final TimeZone timeZone, final Locale locale) {
@@ -177,11 +175,13 @@ abstract class FormatCache<F extends Format> {
     }
 
     /**
-     * <p>Gets a date/time format for the specified styles and locale.</p>
+     * <p>
+     * Gets a date/time format for the specified styles and locale.
+     * </p>
      *
-     * @param dateStyle  date style: FULL, LONG, MEDIUM, or SHORT, null indicates no date in format
-     * @param timeStyle  time style: FULL, LONG, MEDIUM, or SHORT, null indicates no time in format
-     * @param locale  The non-null locale of the desired format
+     * @param dateStyle date style: FULL, LONG, MEDIUM, or SHORT, null indicates no date in format
+     * @param timeStyle time style: FULL, LONG, MEDIUM, or SHORT, null indicates no time in format
+     * @param locale The non-null locale of the desired format
      * @return a localized standard date/time format
      * @throws IllegalArgumentException if the Locale has no date/time pattern defined
      */
@@ -189,26 +189,24 @@ abstract class FormatCache<F extends Format> {
     static String getPatternForStyle(final Integer dateStyle, final Integer timeStyle, final Locale locale) {
         final MultipartKey key = new MultipartKey(dateStyle, timeStyle, locale);
 
-        String pattern = cDateTimeInstanceCache.get(key);
+        String pattern = DATETIME_INSTANCE_CACHE.get(key);
         if (pattern == null) {
             try {
                 DateFormat formatter;
                 if (dateStyle == null) {
                     formatter = DateFormat.getTimeInstance(timeStyle.intValue(), locale);
-                }
-                else if (timeStyle == null) {
+                } else if (timeStyle == null) {
                     formatter = DateFormat.getDateInstance(dateStyle.intValue(), locale);
-                }
-                else {
+                } else {
                     formatter = DateFormat.getDateTimeInstance(dateStyle.intValue(), timeStyle.intValue(), locale);
                 }
-                pattern = ((SimpleDateFormat)formatter).toPattern();
-                final String previous = cDateTimeInstanceCache.putIfAbsent(key, pattern);
+                pattern = ((SimpleDateFormat) formatter).toPattern();
+                final String previous = DATETIME_INSTANCE_CACHE.putIfAbsent(key, pattern);
                 if (previous != null) {
                     // even though it doesn't matter if another thread put the pattern
                     // it's still good practice to return the String instance that is
                     // actually in the ConcurrentMap
-                    pattern= previous;
+                    pattern = previous;
                 }
             } catch (final ClassCastException ex) {
                 throw new IllegalArgumentException("No date time pattern for locale: " + locale);
@@ -219,7 +217,9 @@ abstract class FormatCache<F extends Format> {
 
     // ----------------------------------------------------------------------
     /**
-     * <p>Helper class to hold multi-part Map keys</p>
+     * <p>
+     * Helper class to hold multi-part Map keys
+     * </p>
      */
     private static class MultipartKey {
         private final Object[] keys;
@@ -227,7 +227,8 @@ abstract class FormatCache<F extends Format> {
 
         /**
          * Constructs an instance of <code>MultipartKey</code> to hold the specified objects.
-         * @param keys the set of objects that make up the key.  Each key may be null.
+         * 
+         * @param keys the set of objects that make up the key. Each key may be null.
          */
         public MultipartKey(final Object... keys) {
             this.keys = keys;
@@ -249,14 +250,14 @@ abstract class FormatCache<F extends Format> {
          */
         @Override
         public int hashCode() {
-            if(hashCode==0) {
-                int rc= 0;
-                for(final Object key : keys) {
-                    if(key!=null) {
-                        rc= rc*7 + key.hashCode();
+            if (hashCode == 0) {
+                int rc = 0;
+                for (final Object key : keys) {
+                    if (key != null) {
+                        rc = rc * 7 + key.hashCode();
                     }
                 }
-                hashCode= rc;
+                hashCode = rc;
             }
             return hashCode;
         }

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/f0fca5c2/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/package-info.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/package-info.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/package-info.java
new file mode 100644
index 0000000..31b2b4c
--- /dev/null
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+/**
+ * Log4j 2 date formatting classes.
+ */
+package org.apache.logging.log4j.core.util.datetime;


[2/2] logging-log4j2 git commit: Checkstyle

Posted by rp...@apache.org.
Checkstyle

Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/f0fca5c2
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/f0fca5c2
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/f0fca5c2

Branch: refs/heads/master
Commit: f0fca5c213c2c4cf06338362874699ed61971b5e
Parents: 457ea30
Author: rpopma <rp...@apache.org>
Authored: Thu Sep 24 17:40:48 2015 +0200
Committer: rpopma <rp...@apache.org>
Committed: Thu Sep 24 17:40:48 2015 +0200

----------------------------------------------------------------------
 .../log4j/core/util/NanoClockFactory.java       |   6 +-
 .../log4j/core/util/datetime/DateParser.java    |  34 +-
 .../log4j/core/util/datetime/DatePrinter.java   |   2 +-
 .../core/util/datetime/FastDateFormat.java      | 471 +++++++++---------
 .../core/util/datetime/FastDateParser.java      | 488 ++++++++++---------
 .../core/util/datetime/FastDatePrinter.java     | 346 +++++++------
 .../core/util/datetime/FixedDateFormat.java     |  35 +-
 .../log4j/core/util/datetime/FormatCache.java   | 163 ++++---
 .../log4j/core/util/datetime/package-info.java  |  20 +
 9 files changed, 854 insertions(+), 711 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/f0fca5c2/log4j-core/src/main/java/org/apache/logging/log4j/core/util/NanoClockFactory.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/NanoClockFactory.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/NanoClockFactory.java
index 3ec37c2..2a714ee 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/NanoClockFactory.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/NanoClockFactory.java
@@ -23,9 +23,6 @@ import java.util.Objects;
  * Creates the appropriate {@link NanoClock} instance for the current configuration.
  */
 public final class NanoClockFactory {
-    
-    private NanoClockFactory() {
-    }
 
     /**
      * Enum over the different kinds of nano clocks this factory can create.
@@ -55,6 +52,9 @@ public final class NanoClockFactory {
     
     private static volatile Mode mode = Mode.Dummy;
     
+    private NanoClockFactory() {
+    }
+    
     /**
      * Returns a new {@code NanoClock} determined by the mode of this factory.
      * 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/f0fca5c2/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/DateParser.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/DateParser.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/DateParser.java
index 666ef81..7c45bb7 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/DateParser.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/DateParser.java
@@ -23,50 +23,48 @@ import java.util.Locale;
 import java.util.TimeZone;
 
 /**
- * Copied from Commons Lang 3
+ * Copied from Commons Lang 3.
  */
 public interface DateParser {
 
     /**
-     * Equivalent to DateFormat.parse(String). 
+     * Equivalent to DateFormat.parse(String).
      * 
-     * See {@link java.text.DateFormat#parse(String)} for more information. 
-     * @param source A <code>String</code> whose beginning should be parsed. 
+     * See {@link java.text.DateFormat#parse(String)} for more information.
+     * 
+     * @param source A <code>String</code> whose beginning should be parsed.
      * @return A <code>Date</code> parsed from the string
      * @throws ParseException if the beginning of the specified string cannot be parsed.
      */
     Date parse(String source) throws ParseException;
 
     /**
-     * Equivalent to DateFormat.parse(String, ParsePosition). 
+     * Equivalent to DateFormat.parse(String, ParsePosition).
      * 
-     * See {@link java.text.DateFormat#parse(String, ParsePosition)} for more information. 
+     * See {@link java.text.DateFormat#parse(String, ParsePosition)} for more information.
      * 
      * @param source A <code>String</code>, part of which should be parsed.
-     * @param pos A <code>ParsePosition</code> object with index and error index information 
-     * as described above. 
-     * @return A <code>Date</code> parsed from the string. In case of error, returns null. 
+     * @param pos A <code>ParsePosition</code> object with index and error index information as described above.
+     * @return A <code>Date</code> parsed from the string. In case of error, returns null.
      * @throws NullPointerException if text or pos is null.
      */
     Date parse(String source, ParsePosition pos);
 
     // Accessors
-    //-----------------------------------------------------------------------
+    // -----------------------------------------------------------------------
     /**
-     * <p>Get the pattern used by this parser.</p>
+     * Get the pattern used by this parser.
      * 
      * @return the pattern, {@link java.text.SimpleDateFormat} compatible
      */
     String getPattern();
 
     /**
-     * <p>
      * Get the time zone used by this parser.
-     * </p>
      * 
      * <p>
-     * The default {@link TimeZone} used to create a {@link Date} when the {@link TimeZone} is not specified by
-     * the format pattern.
+     * The default {@link TimeZone} used to create a {@link Date} when the {@link TimeZone} is not specified by the
+     * format pattern.
      * </p>
      * 
      * @return the time zone
@@ -74,7 +72,7 @@ public interface DateParser {
     TimeZone getTimeZone();
 
     /**
-     * <p>Get the locale used by this parser.</p>
+     * Get the locale used by this parser.
      * 
      * @return the locale
      */
@@ -86,7 +84,7 @@ public interface DateParser {
      * @param source A <code>String</code> whose beginning should be parsed.
      * @return a <code>java.util.Date</code> object
      * @throws ParseException if the beginning of the specified string cannot be parsed.
-     * @see java.text.DateFormat#parseObject(String) 
+     * @see java.text.DateFormat#parseObject(String)
      */
     Object parseObject(String source) throws ParseException;
 
@@ -96,7 +94,7 @@ public interface DateParser {
      * @param source A <code>String</code> whose beginning should be parsed.
      * @param pos the parse position
      * @return a <code>java.util.Date</code> object
-     * @see java.text.DateFormat#parseObject(String, ParsePosition) 
+     * @see java.text.DateFormat#parseObject(String, ParsePosition)
      */
     Object parseObject(String source, ParsePosition pos);
 }

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/f0fca5c2/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/DatePrinter.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/DatePrinter.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/DatePrinter.java
index 34919f3..5de0405 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/DatePrinter.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/DatePrinter.java
@@ -23,7 +23,7 @@ import java.util.Locale;
 import java.util.TimeZone;
 
 /**
- * Copied from Commons Lang 3
+ * Copied from Commons Lang 3.
  */
 public interface DatePrinter {
 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/f0fca5c2/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FastDateFormat.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FastDateFormat.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FastDateFormat.java
index 79a07d0..85df633 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FastDateFormat.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FastDateFormat.java
@@ -30,12 +30,6 @@ import java.util.TimeZone;
  * This is a copy of Commons Lang's Fast Date Formatter.
  */
 public class FastDateFormat extends Format implements DatePrinter, DateParser, Serializable {
-    /**
-     * Required for serialization support.
-     *
-     * @see java.io.Serializable
-     */
-    private static final long serialVersionUID = 2L;
 
     /**
      * FULL locale dependent date or time style.
@@ -54,7 +48,14 @@ public class FastDateFormat extends Format implements DatePrinter, DateParser, S
      */
     public static final int SHORT = DateFormat.SHORT;
 
-    private static final FormatCache<FastDateFormat> cache= new FormatCache<FastDateFormat>() {
+    /**
+     * Required for serialization support.
+     *
+     * @see java.io.Serializable
+     */
+    private static final long serialVersionUID = 2L;
+
+    private static final FormatCache<FastDateFormat> CACHE = new FormatCache<FastDateFormat>() {
         @Override
         protected FastDateFormat createInstance(final String pattern, final TimeZone timeZone, final Locale locale) {
             return new FastDateFormat(pattern, timeZone, locale);
@@ -64,305 +65,306 @@ public class FastDateFormat extends Format implements DatePrinter, DateParser, S
     private final FastDatePrinter printer;
     private final FastDateParser parser;
 
-    //-----------------------------------------------------------------------
+    // Constructor
+    // -----------------------------------------------------------------------
     /**
-     * <p>Gets a formatter instance using the default pattern in the
-     * default locale.</p>
+     * <p>
+     * Constructs a new FastDateFormat.
+     * </p>
+     *
+     * @param pattern {@link java.text.SimpleDateFormat} compatible pattern
+     * @param timeZone non-null time zone to use
+     * @param locale non-null locale to use
+     * @throws NullPointerException if pattern, timeZone, or locale is null.
+     */
+    protected FastDateFormat(final String pattern, final TimeZone timeZone, final Locale locale) {
+        this(pattern, timeZone, locale, null);
+    }
+
+    // Constructor
+    // -----------------------------------------------------------------------
+    /**
+     * <p>
+     * Constructs a new FastDateFormat.
+     * </p>
+     *
+     * @param pattern {@link java.text.SimpleDateFormat} compatible pattern
+     * @param timeZone non-null time zone to use
+     * @param locale non-null locale to use
+     * @param centuryStart The start of the 100 year period to use as the "default century" for 2 digit year parsing.
+     *            If centuryStart is null, defaults to now - 80 years
+     * @throws NullPointerException if pattern, timeZone, or locale is null.
+     */
+    protected FastDateFormat(final String pattern, final TimeZone timeZone, final Locale locale,
+            final Date centuryStart) {
+        printer = new FastDatePrinter(pattern, timeZone, locale);
+        parser = new FastDateParser(pattern, timeZone, locale, centuryStart);
+    }
+
+    // -----------------------------------------------------------------------
+    /**
+     * <p>
+     * Gets a formatter instance using the default pattern in the default locale.
+     * </p>
      *
      * @return a date/time formatter
      */
     public static FastDateFormat getInstance() {
-        return cache.getInstance();
+        return CACHE.getInstance();
     }
 
     /**
-     * <p>Gets a formatter instance using the specified pattern in the
-     * default locale.</p>
+     * <p>
+     * Gets a formatter instance using the specified pattern in the default locale.
+     * </p>
      *
-     * @param pattern  {@link java.text.SimpleDateFormat} compatible
-     *  pattern
+     * @param pattern {@link java.text.SimpleDateFormat} compatible pattern
      * @return a pattern based date/time formatter
      * @throws IllegalArgumentException if pattern is invalid
      */
     public static FastDateFormat getInstance(final String pattern) {
-        return cache.getInstance(pattern, null, null);
+        return CACHE.getInstance(pattern, null, null);
     }
 
     /**
-     * <p>Gets a formatter instance using the specified pattern and
-     * time zone.</p>
+     * <p>
+     * Gets a formatter instance using the specified pattern and time zone.
+     * </p>
      *
-     * @param pattern  {@link java.text.SimpleDateFormat} compatible
-     *  pattern
-     * @param timeZone  optional time zone, overrides time zone of
-     *  formatted date
+     * @param pattern {@link java.text.SimpleDateFormat} compatible pattern
+     * @param timeZone optional time zone, overrides time zone of formatted date
      * @return a pattern based date/time formatter
      * @throws IllegalArgumentException if pattern is invalid
      */
     public static FastDateFormat getInstance(final String pattern, final TimeZone timeZone) {
-        return cache.getInstance(pattern, timeZone, null);
+        return CACHE.getInstance(pattern, timeZone, null);
     }
 
     /**
-     * <p>Gets a formatter instance using the specified pattern and
-     * locale.</p>
+     * <p>
+     * Gets a formatter instance using the specified pattern and locale.
+     * </p>
      *
-     * @param pattern  {@link java.text.SimpleDateFormat} compatible
-     *  pattern
-     * @param locale  optional locale, overrides system locale
+     * @param pattern {@link java.text.SimpleDateFormat} compatible pattern
+     * @param locale optional locale, overrides system locale
      * @return a pattern based date/time formatter
      * @throws IllegalArgumentException if pattern is invalid
      */
     public static FastDateFormat getInstance(final String pattern, final Locale locale) {
-        return cache.getInstance(pattern, null, locale);
+        return CACHE.getInstance(pattern, null, locale);
     }
 
     /**
-     * <p>Gets a formatter instance using the specified pattern, time zone
-     * and locale.</p>
+     * <p>
+     * Gets a formatter instance using the specified pattern, time zone and locale.
+     * </p>
      *
-     * @param pattern  {@link java.text.SimpleDateFormat} compatible
-     *  pattern
-     * @param timeZone  optional time zone, overrides time zone of
-     *  formatted date
-     * @param locale  optional locale, overrides system locale
+     * @param pattern {@link java.text.SimpleDateFormat} compatible pattern
+     * @param timeZone optional time zone, overrides time zone of formatted date
+     * @param locale optional locale, overrides system locale
      * @return a pattern based date/time formatter
-     * @throws IllegalArgumentException if pattern is invalid
-     *  or {@code null}
+     * @throws IllegalArgumentException if pattern is invalid or {@code null}
      */
     public static FastDateFormat getInstance(final String pattern, final TimeZone timeZone, final Locale locale) {
-        return cache.getInstance(pattern, timeZone, locale);
+        return CACHE.getInstance(pattern, timeZone, locale);
     }
 
-    //-----------------------------------------------------------------------
+    // -----------------------------------------------------------------------
     /**
-     * <p>Gets a date formatter instance using the specified style in the
-     * default time zone and locale.</p>
+     * <p>
+     * Gets a date formatter instance using the specified style in the default time zone and locale.
+     * </p>
      *
-     * @param style  date style: FULL, LONG, MEDIUM, or SHORT
+     * @param style date style: FULL, LONG, MEDIUM, or SHORT
      * @return a localized standard date formatter
-     * @throws IllegalArgumentException if the Locale has no date
-     *  pattern defined
+     * @throws IllegalArgumentException if the Locale has no date pattern defined
      * @since 2.1
      */
     public static FastDateFormat getDateInstance(final int style) {
-        return cache.getDateInstance(style, null, null);
+        return CACHE.getDateInstance(style, null, null);
     }
 
     /**
-     * <p>Gets a date formatter instance using the specified style and
-     * locale in the default time zone.</p>
+     * <p>
+     * Gets a date formatter instance using the specified style and locale in the default time zone.
+     * </p>
      *
-     * @param style  date style: FULL, LONG, MEDIUM, or SHORT
-     * @param locale  optional locale, overrides system locale
+     * @param style date style: FULL, LONG, MEDIUM, or SHORT
+     * @param locale optional locale, overrides system locale
      * @return a localized standard date formatter
-     * @throws IllegalArgumentException if the Locale has no date
-     *  pattern defined
+     * @throws IllegalArgumentException if the Locale has no date pattern defined
      * @since 2.1
      */
     public static FastDateFormat getDateInstance(final int style, final Locale locale) {
-        return cache.getDateInstance(style, null, locale);
+        return CACHE.getDateInstance(style, null, locale);
     }
 
     /**
-     * <p>Gets a date formatter instance using the specified style and
-     * time zone in the default locale.</p>
+     * <p>
+     * Gets a date formatter instance using the specified style and time zone in the default locale.
+     * </p>
      *
-     * @param style  date style: FULL, LONG, MEDIUM, or SHORT
-     * @param timeZone  optional time zone, overrides time zone of
-     *  formatted date
+     * @param style date style: FULL, LONG, MEDIUM, or SHORT
+     * @param timeZone optional time zone, overrides time zone of formatted date
      * @return a localized standard date formatter
-     * @throws IllegalArgumentException if the Locale has no date
-     *  pattern defined
+     * @throws IllegalArgumentException if the Locale has no date pattern defined
      * @since 2.1
      */
     public static FastDateFormat getDateInstance(final int style, final TimeZone timeZone) {
-        return cache.getDateInstance(style, timeZone, null);
+        return CACHE.getDateInstance(style, timeZone, null);
     }
 
     /**
-     * <p>Gets a date formatter instance using the specified style, time
-     * zone and locale.</p>
+     * <p>
+     * Gets a date formatter instance using the specified style, time zone and locale.
+     * </p>
      *
-     * @param style  date style: FULL, LONG, MEDIUM, or SHORT
-     * @param timeZone  optional time zone, overrides time zone of
-     *  formatted date
-     * @param locale  optional locale, overrides system locale
+     * @param style date style: FULL, LONG, MEDIUM, or SHORT
+     * @param timeZone optional time zone, overrides time zone of formatted date
+     * @param locale optional locale, overrides system locale
      * @return a localized standard date formatter
-     * @throws IllegalArgumentException if the Locale has no date
-     *  pattern defined
+     * @throws IllegalArgumentException if the Locale has no date pattern defined
      */
     public static FastDateFormat getDateInstance(final int style, final TimeZone timeZone, final Locale locale) {
-        return cache.getDateInstance(style, timeZone, locale);
+        return CACHE.getDateInstance(style, timeZone, locale);
     }
 
-    //-----------------------------------------------------------------------
+    // -----------------------------------------------------------------------
     /**
-     * <p>Gets a time formatter instance using the specified style in the
-     * default time zone and locale.</p>
+     * <p>
+     * Gets a time formatter instance using the specified style in the default time zone and locale.
+     * </p>
      *
-     * @param style  time style: FULL, LONG, MEDIUM, or SHORT
+     * @param style time style: FULL, LONG, MEDIUM, or SHORT
      * @return a localized standard time formatter
-     * @throws IllegalArgumentException if the Locale has no time
-     *  pattern defined
+     * @throws IllegalArgumentException if the Locale has no time pattern defined
      * @since 2.1
      */
     public static FastDateFormat getTimeInstance(final int style) {
-        return cache.getTimeInstance(style, null, null);
+        return CACHE.getTimeInstance(style, null, null);
     }
 
     /**
-     * <p>Gets a time formatter instance using the specified style and
-     * locale in the default time zone.</p>
+     * <p>
+     * Gets a time formatter instance using the specified style and locale in the default time zone.
+     * </p>
      *
-     * @param style  time style: FULL, LONG, MEDIUM, or SHORT
-     * @param locale  optional locale, overrides system locale
+     * @param style time style: FULL, LONG, MEDIUM, or SHORT
+     * @param locale optional locale, overrides system locale
      * @return a localized standard time formatter
-     * @throws IllegalArgumentException if the Locale has no time
-     *  pattern defined
+     * @throws IllegalArgumentException if the Locale has no time pattern defined
      * @since 2.1
      */
     public static FastDateFormat getTimeInstance(final int style, final Locale locale) {
-        return cache.getTimeInstance(style, null, locale);
+        return CACHE.getTimeInstance(style, null, locale);
     }
 
     /**
-     * <p>Gets a time formatter instance using the specified style and
-     * time zone in the default locale.</p>
+     * <p>
+     * Gets a time formatter instance using the specified style and time zone in the default locale.
+     * </p>
      *
-     * @param style  time style: FULL, LONG, MEDIUM, or SHORT
-     * @param timeZone  optional time zone, overrides time zone of
-     *  formatted time
+     * @param style time style: FULL, LONG, MEDIUM, or SHORT
+     * @param timeZone optional time zone, overrides time zone of formatted time
      * @return a localized standard time formatter
-     * @throws IllegalArgumentException if the Locale has no time
-     *  pattern defined
+     * @throws IllegalArgumentException if the Locale has no time pattern defined
      * @since 2.1
      */
     public static FastDateFormat getTimeInstance(final int style, final TimeZone timeZone) {
-        return cache.getTimeInstance(style, timeZone, null);
+        return CACHE.getTimeInstance(style, timeZone, null);
     }
 
     /**
-     * <p>Gets a time formatter instance using the specified style, time
-     * zone and locale.</p>
+     * <p>
+     * Gets a time formatter instance using the specified style, time zone and locale.
+     * </p>
      *
-     * @param style  time style: FULL, LONG, MEDIUM, or SHORT
-     * @param timeZone  optional time zone, overrides time zone of
-     *  formatted time
-     * @param locale  optional locale, overrides system locale
+     * @param style time style: FULL, LONG, MEDIUM, or SHORT
+     * @param timeZone optional time zone, overrides time zone of formatted time
+     * @param locale optional locale, overrides system locale
      * @return a localized standard time formatter
-     * @throws IllegalArgumentException if the Locale has no time
-     *  pattern defined
+     * @throws IllegalArgumentException if the Locale has no time pattern defined
      */
     public static FastDateFormat getTimeInstance(final int style, final TimeZone timeZone, final Locale locale) {
-        return cache.getTimeInstance(style, timeZone, locale);
+        return CACHE.getTimeInstance(style, timeZone, locale);
     }
 
-    //-----------------------------------------------------------------------
+    // -----------------------------------------------------------------------
     /**
-     * <p>Gets a date/time formatter instance using the specified style
-     * in the default time zone and locale.</p>
+     * <p>
+     * Gets a date/time formatter instance using the specified style in the default time zone and locale.
+     * </p>
      *
-     * @param dateStyle  date style: FULL, LONG, MEDIUM, or SHORT
-     * @param timeStyle  time style: FULL, LONG, MEDIUM, or SHORT
+     * @param dateStyle date style: FULL, LONG, MEDIUM, or SHORT
+     * @param timeStyle time style: FULL, LONG, MEDIUM, or SHORT
      * @return a localized standard date/time formatter
-     * @throws IllegalArgumentException if the Locale has no date/time
-     *  pattern defined
+     * @throws IllegalArgumentException if the Locale has no date/time pattern defined
      * @since 2.1
      */
     public static FastDateFormat getDateTimeInstance(final int dateStyle, final int timeStyle) {
-        return cache.getDateTimeInstance(dateStyle, timeStyle, null, null);
+        return CACHE.getDateTimeInstance(dateStyle, timeStyle, null, null);
     }
 
     /**
-     * <p>Gets a date/time formatter instance using the specified style and
-     * locale in the default time zone.</p>
+     * <p>
+     * Gets a date/time formatter instance using the specified style and locale in the default time zone.
+     * </p>
      *
-     * @param dateStyle  date style: FULL, LONG, MEDIUM, or SHORT
-     * @param timeStyle  time style: FULL, LONG, MEDIUM, or SHORT
-     * @param locale  optional locale, overrides system locale
+     * @param dateStyle date style: FULL, LONG, MEDIUM, or SHORT
+     * @param timeStyle time style: FULL, LONG, MEDIUM, or SHORT
+     * @param locale optional locale, overrides system locale
      * @return a localized standard date/time formatter
-     * @throws IllegalArgumentException if the Locale has no date/time
-     *  pattern defined
+     * @throws IllegalArgumentException if the Locale has no date/time pattern defined
      * @since 2.1
      */
     public static FastDateFormat getDateTimeInstance(final int dateStyle, final int timeStyle, final Locale locale) {
-        return cache.getDateTimeInstance(dateStyle, timeStyle, null, locale);
+        return CACHE.getDateTimeInstance(dateStyle, timeStyle, null, locale);
     }
 
     /**
-     * <p>Gets a date/time formatter instance using the specified style and
-     * time zone in the default locale.</p>
+     * <p>
+     * Gets a date/time formatter instance using the specified style and time zone in the default locale.
+     * </p>
      *
-     * @param dateStyle  date style: FULL, LONG, MEDIUM, or SHORT
-     * @param timeStyle  time style: FULL, LONG, MEDIUM, or SHORT
-     * @param timeZone  optional time zone, overrides time zone of
-     *  formatted date
+     * @param dateStyle date style: FULL, LONG, MEDIUM, or SHORT
+     * @param timeStyle time style: FULL, LONG, MEDIUM, or SHORT
+     * @param timeZone optional time zone, overrides time zone of formatted date
      * @return a localized standard date/time formatter
-     * @throws IllegalArgumentException if the Locale has no date/time
-     *  pattern defined
+     * @throws IllegalArgumentException if the Locale has no date/time pattern defined
      * @since 2.1
      */
-    public static FastDateFormat getDateTimeInstance(final int dateStyle, final int timeStyle, final TimeZone timeZone) {
+    public static FastDateFormat getDateTimeInstance(final int dateStyle, final int timeStyle,
+            final TimeZone timeZone) {
         return getDateTimeInstance(dateStyle, timeStyle, timeZone, null);
     }
-    /**
-     * <p>Gets a date/time formatter instance using the specified style,
-     * time zone and locale.</p>
-     *
-     * @param dateStyle  date style: FULL, LONG, MEDIUM, or SHORT
-     * @param timeStyle  time style: FULL, LONG, MEDIUM, or SHORT
-     * @param timeZone  optional time zone, overrides time zone of
-     *  formatted date
-     * @param locale  optional locale, overrides system locale
-     * @return a localized standard date/time formatter
-     * @throws IllegalArgumentException if the Locale has no date/time
-     *  pattern defined
-     */
-    public static FastDateFormat getDateTimeInstance(
-            final int dateStyle, final int timeStyle, final TimeZone timeZone, final Locale locale) {
-        return cache.getDateTimeInstance(dateStyle, timeStyle, timeZone, locale);
-    }
 
-    // Constructor
-    //-----------------------------------------------------------------------
     /**
-     * <p>Constructs a new FastDateFormat.</p>
+     * <p>
+     * Gets a date/time formatter instance using the specified style, time zone and locale.
+     * </p>
      *
-     * @param pattern  {@link java.text.SimpleDateFormat} compatible pattern
-     * @param timeZone  non-null time zone to use
-     * @param locale  non-null locale to use
-     * @throws NullPointerException if pattern, timeZone, or locale is null.
-     */
-    protected FastDateFormat(final String pattern, final TimeZone timeZone, final Locale locale) {
-        this(pattern, timeZone, locale, null);
-    }
-
-    // Constructor
-    //-----------------------------------------------------------------------
-    /**
-     * <p>Constructs a new FastDateFormat.</p>
-     *
-     * @param pattern  {@link java.text.SimpleDateFormat} compatible pattern
-     * @param timeZone  non-null time zone to use
-     * @param locale  non-null locale to use
-     * @param centuryStart The start of the 100 year period to use as the "default century" for 2 digit year parsing.  If centuryStart is null, defaults to now - 80 years
-     * @throws NullPointerException if pattern, timeZone, or locale is null.
+     * @param dateStyle date style: FULL, LONG, MEDIUM, or SHORT
+     * @param timeStyle time style: FULL, LONG, MEDIUM, or SHORT
+     * @param timeZone optional time zone, overrides time zone of formatted date
+     * @param locale optional locale, overrides system locale
+     * @return a localized standard date/time formatter
+     * @throws IllegalArgumentException if the Locale has no date/time pattern defined
      */
-    protected FastDateFormat(final String pattern, final TimeZone timeZone, final Locale locale, final Date centuryStart) {
-        printer= new FastDatePrinter(pattern, timeZone, locale);
-        parser= new FastDateParser(pattern, timeZone, locale, centuryStart);
+    public static FastDateFormat getDateTimeInstance(final int dateStyle, final int timeStyle,
+            final TimeZone timeZone, final Locale locale) {
+        return CACHE.getDateTimeInstance(dateStyle, timeStyle, timeZone, locale);
     }
 
     // Format methods
-    //-----------------------------------------------------------------------
+    // -----------------------------------------------------------------------
     /**
-     * <p>Formats a {@code Date}, {@code Calendar} or
-     * {@code Long} (milliseconds) object.</p>
+     * <p>
+     * Formats a {@code Date}, {@code Calendar} or {@code Long} (milliseconds) object.
+     * </p>
      *
-     * @param obj  the object to format
-     * @param toAppendTo  the buffer to append to
-     * @param pos  the position - ignored
+     * @param obj the object to format
+     * @param toAppendTo the buffer to append to
+     * @param pos the position - ignored
      * @return the buffer passed in
      */
     @Override
@@ -371,9 +373,11 @@ public class FastDateFormat extends Format implements DatePrinter, DateParser, S
     }
 
     /**
-     * <p>Formats a millisecond {@code long} value.</p>
+     * <p>
+     * Formats a millisecond {@code long} value.
+     * </p>
      *
-     * @param millis  the millisecond value to format
+     * @param millis the millisecond value to format
      * @return the formatted string
      * @since 2.1
      */
@@ -383,9 +387,11 @@ public class FastDateFormat extends Format implements DatePrinter, DateParser, S
     }
 
     /**
-     * <p>Formats a {@code Date} object using a {@code GregorianCalendar}.</p>
+     * <p>
+     * Formats a {@code Date} object using a {@code GregorianCalendar}.
+     * </p>
      *
-     * @param date  the date to format
+     * @param date the date to format
      * @return the formatted string
      */
     @Override
@@ -394,9 +400,11 @@ public class FastDateFormat extends Format implements DatePrinter, DateParser, S
     }
 
     /**
-     * <p>Formats a {@code Calendar} object.</p>
+     * <p>
+     * Formats a {@code Calendar} object.
+     * </p>
      *
-     * @param calendar  the calendar to format
+     * @param calendar the calendar to format
      * @return the formatted string
      */
     @Override
@@ -405,11 +413,12 @@ public class FastDateFormat extends Format implements DatePrinter, DateParser, S
     }
 
     /**
-     * <p>Formats a millisecond {@code long} value into the
-     * supplied {@code StringBuilder}.</p>
+     * <p>
+     * Formats a millisecond {@code long} value into the supplied {@code StringBuilder}.
+     * </p>
      *
-     * @param millis  the millisecond value to format
-     * @param buf  the buffer to format into
+     * @param millis the millisecond value to format
+     * @param buf the buffer to format into
      * @return the specified string buffer
      * @since 2.1
      */
@@ -419,11 +428,12 @@ public class FastDateFormat extends Format implements DatePrinter, DateParser, S
     }
 
     /**
-     * <p>Formats a {@code Date} object into the
-     * supplied {@code StringBuilder} using a {@code GregorianCalendar}.</p>
+     * <p>
+     * Formats a {@code Date} object into the supplied {@code StringBuilder} using a {@code GregorianCalendar}.
+     * </p>
      *
-     * @param date  the date to format
-     * @param buf  the buffer to format into
+     * @param date the date to format
+     * @param buf the buffer to format into
      * @return the specified string buffer
      */
     @Override
@@ -432,11 +442,12 @@ public class FastDateFormat extends Format implements DatePrinter, DateParser, S
     }
 
     /**
-     * <p>Formats a {@code Calendar} object into the
-     * supplied {@code StringBuilder}.</p>
+     * <p>
+     * Formats a {@code Calendar} object into the supplied {@code StringBuilder}.
+     * </p>
      *
-     * @param calendar  the calendar to format
-     * @param buf  the buffer to format into
+     * @param calendar the calendar to format
+     * @param buf the buffer to format into
      * @return the specified string buffer
      */
     @Override
@@ -445,10 +456,11 @@ public class FastDateFormat extends Format implements DatePrinter, DateParser, S
     }
 
     // Parsing
-    //-----------------------------------------------------------------------
-
+    // -----------------------------------------------------------------------
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see DateParser#parse(java.lang.String)
      */
     @Override
@@ -456,7 +468,9 @@ public class FastDateFormat extends Format implements DatePrinter, DateParser, S
         return parser.parse(source);
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see DateParser#parse(java.lang.String, java.text.ParsePosition)
      */
     @Override
@@ -464,7 +478,9 @@ public class FastDateFormat extends Format implements DatePrinter, DateParser, S
         return parser.parse(source, pos);
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see java.text.Format#parseObject(java.lang.String, java.text.ParsePosition)
      */
     @Override
@@ -473,9 +489,11 @@ public class FastDateFormat extends Format implements DatePrinter, DateParser, S
     }
 
     // Accessors
-    //-----------------------------------------------------------------------
+    // -----------------------------------------------------------------------
     /**
-     * <p>Gets the pattern used by this formatter.</p>
+     * <p>
+     * Gets the pattern used by this formatter.
+     * </p>
      *
      * @return the pattern, {@link java.text.SimpleDateFormat} compatible
      */
@@ -485,9 +503,13 @@ public class FastDateFormat extends Format implements DatePrinter, DateParser, S
     }
 
     /**
-     * <p>Gets the time zone used by this formatter.</p>
+     * <p>
+     * Gets the time zone used by this formatter.
+     * </p>
      *
-     * <p>This zone is always used for {@code Date} formatting. </p>
+     * <p>
+     * This zone is always used for {@code Date} formatting.
+     * </p>
      *
      * @return the time zone
      */
@@ -497,7 +519,9 @@ public class FastDateFormat extends Format implements DatePrinter, DateParser, S
     }
 
     /**
-     * <p>Gets the locale used by this formatter.</p>
+     * <p>
+     * Gets the locale used by this formatter.
+     * </p>
      *
      * @return the locale
      */
@@ -507,11 +531,13 @@ public class FastDateFormat extends Format implements DatePrinter, DateParser, S
     }
 
     /**
-     * <p>Gets an estimate for the maximum string length that the
-     * formatter will produce.</p>
+     * <p>
+     * Gets an estimate for the maximum string length that the formatter will produce.
+     * </p>
      *
-     * <p>The actual formatted length will almost always be less than or
-     * equal to this amount.</p>
+     * <p>
+     * The actual formatted length will almost always be less than or equal to this amount.
+     * </p>
      *
      * @return the maximum formatted length
      */
@@ -524,16 +550,18 @@ public class FastDateFormat extends Format implements DatePrinter, DateParser, S
     }
 
     // Basics
-    //-----------------------------------------------------------------------
+    // -----------------------------------------------------------------------
     /**
-     * <p>Compares two objects for equality.</p>
+     * <p>
+     * Compares two objects for equality.
+     * </p>
      *
-     * @param obj  the object to compare to
+     * @param obj the object to compare to
      * @return {@code true} if equal
      */
     @Override
     public boolean equals(final Object obj) {
-        if (obj instanceof FastDateFormat == false) {
+        if (!(obj instanceof FastDateFormat)) {
             return false;
         }
         final FastDateFormat other = (FastDateFormat) obj;
@@ -542,7 +570,9 @@ public class FastDateFormat extends Format implements DatePrinter, DateParser, S
     }
 
     /**
-     * <p>Returns a hashcode compatible with equals.</p>
+     * <p>
+     * Returns a hashcode compatible with equals.
+     * </p>
      *
      * @return a hashcode compatible with equals
      */
@@ -552,28 +582,29 @@ public class FastDateFormat extends Format implements DatePrinter, DateParser, S
     }
 
     /**
-     * <p>Gets a debugging string version of this formatter.</p>
+     * <p>
+     * Gets a debugging string version of this formatter.
+     * </p>
      *
      * @return a debugging string
      */
     @Override
     public String toString() {
-        return "FastDateFormat[" + printer.getPattern() + "," + printer.getLocale() + "," + printer.getTimeZone().getID() + "]";
+        return "FastDateFormat[" + printer.getPattern() + "," + printer.getLocale() + ","
+                + printer.getTimeZone().getID() + "]";
     }
 
-
     /**
-     * <p>Performs the formatting by applying the rules to the
-     * specified calendar.</p>
+     * <p>
+     * Performs the formatting by applying the rules to the specified calendar.
+     * </p>
      *
-     * @param calendar  the calendar to format
-     * @param buf  the buffer to format into
+     * @param calendar the calendar to format
+     * @param buf the buffer to format into
      * @return the specified string buffer
      */
     protected StringBuilder applyRules(final Calendar calendar, final StringBuilder buf) {
         return printer.applyRules(calendar, buf);
     }
 
-
 }
-

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/f0fca5c2/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FastDateParser.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FastDateParser.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FastDateParser.java
index f259e4a..37e049b 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FastDateParser.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FastDateParser.java
@@ -36,9 +36,15 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 /**
- * Copied from Commons Lang 3
+ * Copied from Commons Lang 3.
  */
 public class FastDateParser implements DateParser, Serializable {
+
+    /**
+     * Japanese locale support.
+     */
+    static final Locale JAPANESE_IMPERIAL = new Locale("ja", "JP", "JP");
+
     /**
      * Required for serialization support.
      *
@@ -46,7 +52,51 @@ public class FastDateParser implements DateParser, Serializable {
      */
     private static final long serialVersionUID = 3L;
 
-    static final Locale JAPANESE_IMPERIAL = new Locale("ja","JP","JP");
+    private static final Strategy NUMBER_MONTH_STRATEGY = new NumberStrategy(Calendar.MONTH) {
+        @Override
+        int modify(final int iValue) {
+            return iValue - 1;
+        }
+    };
+
+    private static final Strategy ABBREVIATED_YEAR_STRATEGY = new NumberStrategy(Calendar.YEAR) {
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        void setCalendar(final FastDateParser parser, final Calendar cal, final String value) {
+            int iValue = Integer.parseInt(value);
+            if (iValue < 100) {
+                iValue = parser.adjustYear(iValue);
+            }
+            cal.set(Calendar.YEAR, iValue);
+        }
+    };
+
+    private static final Strategy LITERAL_YEAR_STRATEGY = new NumberStrategy(Calendar.YEAR);
+    private static final Strategy WEEK_OF_YEAR_STRATEGY = new NumberStrategy(Calendar.WEEK_OF_YEAR);
+    private static final Strategy WEEK_OF_MONTH_STRATEGY = new NumberStrategy(Calendar.WEEK_OF_MONTH);
+    private static final Strategy DAY_OF_YEAR_STRATEGY = new NumberStrategy(Calendar.DAY_OF_YEAR);
+    private static final Strategy DAY_OF_MONTH_STRATEGY = new NumberStrategy(Calendar.DAY_OF_MONTH);
+    private static final Strategy DAY_OF_WEEK_IN_MONTH_STRATEGY = new NumberStrategy(Calendar.DAY_OF_WEEK_IN_MONTH);
+    private static final Strategy HOUR_OF_DAY_STRATEGY = new NumberStrategy(Calendar.HOUR_OF_DAY);
+    private static final Strategy HOUR24_OF_DAY_STRATEGY = new NumberStrategy(Calendar.HOUR_OF_DAY) {
+        @Override
+        int modify(final int iValue) {
+            return iValue == 24 ? 0 : iValue;
+        }
+    };
+    private static final Strategy HOUR12_STRATEGY = new NumberStrategy(Calendar.HOUR) {
+        @Override
+        int modify(final int iValue) {
+            return iValue == 12 ? 0 : iValue;
+        }
+    };
+    private static final Strategy HOUR_STRATEGY = new NumberStrategy(Calendar.HOUR);
+    private static final Strategy MINUTE_STRATEGY = new NumberStrategy(Calendar.MINUTE);
+    private static final Strategy SECOND_STRATEGY = new NumberStrategy(Calendar.SECOND);
+    private static final Strategy MILLISECOND_STRATEGY = new NumberStrategy(Calendar.MILLISECOND);
+    private static final Strategy ISO_8601_STRATEGY = new ISO8601TimeZoneStrategy("(Z|(?:[+-]\\d{2}(?::?\\d{2})?))");
 
     // defining fields
     private final String pattern;
@@ -65,13 +115,14 @@ public class FastDateParser implements DateParser, Serializable {
     private transient Strategy nextStrategy;
 
     /**
-     * <p>Constructs a new FastDateParser.</p>
+     * <p>
+     * Constructs a new FastDateParser.
+     * </p>
      * 
-     * Use {@link FastDateFormat#getInstance(String, TimeZone, Locale)} or another variation of the 
-     * factory methods of {@link FastDateFormat} to get a cached FastDateParser instance.
+     * Use {@link FastDateFormat#getInstance(String, TimeZone, Locale)} or another variation of the factory methods of
+     * {@link FastDateFormat} to get a cached FastDateParser instance.
      *
-     * @param pattern non-null {@link java.text.SimpleDateFormat} compatible
-     *  pattern
+     * @param pattern non-null {@link java.text.SimpleDateFormat} compatible pattern
      * @param timeZone non-null time zone to use
      * @param locale non-null locale
      */
@@ -80,10 +131,11 @@ public class FastDateParser implements DateParser, Serializable {
     }
 
     /**
-     * <p>Constructs a new FastDateParser.</p>
+     * <p>
+     * Constructs a new FastDateParser.
+     * </p>
      *
-     * @param pattern non-null {@link java.text.SimpleDateFormat} compatible
-     *  pattern
+     * @param pattern non-null {@link java.text.SimpleDateFormat} compatible pattern
      * @param timeZone non-null time zone to use
      * @param locale non-null locale
      * @param centuryStart The start of the century for 2 digit year parsing
@@ -95,15 +147,16 @@ public class FastDateParser implements DateParser, Serializable {
     }
 
     /**
-     * <p>Constructs a new FastDateParser.</p>
+     * <p>
+     * Constructs a new FastDateParser.
+     * </p>
      *
-     * @param pattern non-null {@link java.text.SimpleDateFormat} compatible
-     *  pattern
+     * @param pattern non-null {@link java.text.SimpleDateFormat} compatible pattern
      * @param timeZone non-null time zone to use
      * @param locale non-null locale
      * @param centuryStart The start of the century for 2 digit year parsing
-     * @param lenient if true, non-standard values for Calendar fields should be accepted;
-     * if false, non-standard values will cause a ParseException to be thrown {@link Calendar#setLenient(boolean)}
+     * @param lenient if true, non-standard values for Calendar fields should be accepted; if false, non-standard values
+     *            will cause a ParseException to be thrown {@link Calendar#setLenient(boolean)}
      *
      * @since 3.5
      */
@@ -117,71 +170,72 @@ public class FastDateParser implements DateParser, Serializable {
         final Calendar definingCalendar = Calendar.getInstance(timeZone, locale);
 
         int centuryStartYear;
-        if(centuryStart!=null) {
+        if (centuryStart != null) {
             definingCalendar.setTime(centuryStart);
-            centuryStartYear= definingCalendar.get(Calendar.YEAR);
-        }
-        else if(locale.equals(JAPANESE_IMPERIAL)) {
-            centuryStartYear= 0;
-        }
-        else {
+            centuryStartYear = definingCalendar.get(Calendar.YEAR);
+        } else if (locale.equals(JAPANESE_IMPERIAL)) {
+            centuryStartYear = 0;
+        } else {
             // from 80 years ago to 20 years from now
             definingCalendar.setTime(new Date());
-            centuryStartYear= definingCalendar.get(Calendar.YEAR)-80;
+            centuryStartYear = definingCalendar.get(Calendar.YEAR) - 80;
         }
-        century= centuryStartYear / 100 * 100;
-        startYear= centuryStartYear - century;
+        century = centuryStartYear / 100 * 100;
+        startYear = centuryStartYear - century;
 
         init(definingCalendar);
     }
 
     /**
-     * Initialize derived fields from defining fields.
-     * This is called from constructor and from readObject (de-serialization)
+     * Initialize derived fields from defining fields. This is called from constructor and from readObject
+     * (de-serialization)
      *
      * @param definingCalendar the {@link java.util.Calendar} instance used to initialize this FastDateParser
      */
     private void init(final Calendar definingCalendar) {
 
-        final StringBuilder regex= new StringBuilder();
+        final StringBuilder regex = new StringBuilder();
         final List<Strategy> collector = new ArrayList<Strategy>();
 
-        final Matcher patternMatcher= formatPattern.matcher(pattern);
-        if(!patternMatcher.lookingAt()) {
-            throw new IllegalArgumentException(
-                    "Illegal pattern character '" + pattern.charAt(patternMatcher.regionStart()) + "'");
+        final Matcher patternMatcher = formatPattern.matcher(pattern);
+        if (!patternMatcher.lookingAt()) {
+            throw new IllegalArgumentException("Illegal pattern character '"
+                    + pattern.charAt(patternMatcher.regionStart()) + "'");
         }
 
-        currentFormatField= patternMatcher.group();
-        Strategy currentStrategy= getStrategy(currentFormatField, definingCalendar);
-        for(;;) {
+        currentFormatField = patternMatcher.group();
+        Strategy currentStrategy = getStrategy(currentFormatField, definingCalendar);
+        for (;;) {
             patternMatcher.region(patternMatcher.end(), patternMatcher.regionEnd());
-            if(!patternMatcher.lookingAt()) {
+            if (!patternMatcher.lookingAt()) {
                 nextStrategy = null;
                 break;
             }
-            final String nextFormatField= patternMatcher.group();
+            final String nextFormatField = patternMatcher.group();
             nextStrategy = getStrategy(nextFormatField, definingCalendar);
-            if(currentStrategy.addRegex(this, regex)) {
+            if (currentStrategy.addRegex(this, regex)) {
                 collector.add(currentStrategy);
             }
-            currentFormatField= nextFormatField;
-            currentStrategy= nextStrategy;
+            currentFormatField = nextFormatField;
+            currentStrategy = nextStrategy;
         }
         if (patternMatcher.regionStart() != patternMatcher.regionEnd()) {
-            throw new IllegalArgumentException("Failed to parse \""+pattern+"\" ; gave up at index "+patternMatcher.regionStart());
+            throw new IllegalArgumentException("Failed to parse \"" + pattern + "\" ; gave up at index "
+                    + patternMatcher.regionStart());
         }
-        if(currentStrategy.addRegex(this, regex)) {
+        if (currentStrategy.addRegex(this, regex)) {
             collector.add(currentStrategy);
         }
-        currentFormatField= null;
-        strategies= collector.toArray(new Strategy[collector.size()]);
-        parsePattern= Pattern.compile(regex.toString());
+        currentFormatField = null;
+        strategies = collector.toArray(new Strategy[collector.size()]);
+        parsePattern = Pattern.compile(regex.toString());
     }
 
     // Accessors
-    //-----------------------------------------------------------------------
-    /* (non-Javadoc)
+    // -----------------------------------------------------------------------
+    /*
+     * (non-Javadoc)
+     * 
      * @see org.apache.commons.lang3.time.DateParser#getPattern()
      */
     @Override
@@ -189,7 +243,9 @@ public class FastDateParser implements DateParser, Serializable {
         return pattern;
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see org.apache.commons.lang3.time.DateParser#getTimeZone()
      */
     @Override
@@ -197,7 +253,9 @@ public class FastDateParser implements DateParser, Serializable {
         return timeZone;
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see org.apache.commons.lang3.time.DateParser#getLocale()
      */
     @Override
@@ -215,26 +273,28 @@ public class FastDateParser implements DateParser, Serializable {
     }
 
     // Basics
-    //-----------------------------------------------------------------------
+    // -----------------------------------------------------------------------
     /**
-     * <p>Compare another object for equality with this object.</p>
+     * <p>
+     * Compare another object for equality with this object.
+     * </p>
      *
-     * @param obj  the object to compare to
+     * @param obj the object to compare to
      * @return <code>true</code>if equal to this instance
      */
     @Override
     public boolean equals(final Object obj) {
-        if (! (obj instanceof FastDateParser) ) {
+        if (!(obj instanceof FastDateParser)) {
             return false;
         }
         final FastDateParser other = (FastDateParser) obj;
-        return pattern.equals(other.pattern)
-            && timeZone.equals(other.timeZone)
-            && locale.equals(other.locale);
+        return pattern.equals(other.pattern) && timeZone.equals(other.timeZone) && locale.equals(other.locale);
     }
 
     /**
-     * <p>Return a hashcode compatible with equals.</p>
+     * <p>
+     * Return a hashcode compatible with equals.
+     * </p>
      *
      * @return a hashcode compatible with equals
      */
@@ -244,7 +304,9 @@ public class FastDateParser implements DateParser, Serializable {
     }
 
     /**
-     * <p>Get a string version of this formatter.</p>
+     * <p>
+     * Get a string version of this formatter.
+     * </p>
      *
      * @return a debugging string
      */
@@ -254,10 +316,9 @@ public class FastDateParser implements DateParser, Serializable {
     }
 
     // Serializing
-    //-----------------------------------------------------------------------
+    // -----------------------------------------------------------------------
     /**
-     * Create the object after serialization. This implementation reinitializes the
-     * transient properties.
+     * Create the object after serialization. This implementation reinitializes the transient properties.
      *
      * @param in ObjectInputStream from which the object is being deserialized.
      * @throws IOException if there is an IO issue.
@@ -270,7 +331,9 @@ public class FastDateParser implements DateParser, Serializable {
         init(definingCalendar);
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see org.apache.commons.lang3.time.DateParser#parseObject(java.lang.String)
      */
     @Override
@@ -278,25 +341,28 @@ public class FastDateParser implements DateParser, Serializable {
         return parse(source);
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see org.apache.commons.lang3.time.DateParser#parse(java.lang.String)
      */
     @Override
     public Date parse(final String source) throws ParseException {
-        final Date date= parse(source, new ParsePosition(0));
-        if(date==null) {
+        final Date date = parse(source, new ParsePosition(0));
+        if (date == null) {
             // Add a note re supported date range
             if (locale.equals(JAPANESE_IMPERIAL)) {
-                throw new ParseException(
-                        "(The " +locale + " locale does not support dates before 1868 AD)\n" +
-                                "Unparseable date: \""+source+"\" does not match "+parsePattern.pattern(), 0);
+                throw new ParseException("(The " + locale + " locale does not support dates before 1868 AD)\n"
+                        + "Unparseable date: \"" + source + "\" does not match " + parsePattern.pattern(), 0);
             }
-            throw new ParseException("Unparseable date: \""+source+"\" does not match "+parsePattern.pattern(), 0);
+            throw new ParseException("Unparseable date: \"" + source + "\" does not match " + parsePattern.pattern(), 0);
         }
         return date;
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see org.apache.commons.lang3.time.DateParser#parseObject(java.lang.String, java.text.ParsePosition)
      */
     @Override
@@ -305,43 +371,43 @@ public class FastDateParser implements DateParser, Serializable {
     }
 
     /**
-     * This implementation updates the ParsePosition if the parse succeeeds.
-     * However, unlike the method {@link java.text.SimpleDateFormat#parse(String, ParsePosition)}
-     * it is not able to set the error Index - i.e. {@link ParsePosition#getErrorIndex()} -  if the parse fails.
+     * This implementation updates the ParsePosition if the parse succeeeds. However, unlike the method
+     * {@link java.text.SimpleDateFormat#parse(String, ParsePosition)} it is not able to set the error Index - i.e.
+     * {@link ParsePosition#getErrorIndex()} - if the parse fails.
      * <p>
-     * To determine if the parse has succeeded, the caller must check if the current parse position
-     * given by {@link ParsePosition#getIndex()} has been updated. If the input buffer has been fully
-     * parsed, then the index will point to just after the end of the input buffer.
+     * To determine if the parse has succeeded, the caller must check if the current parse position given by
+     * {@link ParsePosition#getIndex()} has been updated. If the input buffer has been fully parsed, then the index will
+     * point to just after the end of the input buffer.
      *
      * {@inheritDoc}
      */
     @Override
     public Date parse(final String source, final ParsePosition pos) {
-        final int offset= pos.getIndex();
-        final Matcher matcher= parsePattern.matcher(source.substring(offset));
-        if(!matcher.lookingAt()) {
+        final int offset = pos.getIndex();
+        final Matcher matcher = parsePattern.matcher(source.substring(offset));
+        if (!matcher.lookingAt()) {
             return null;
         }
         // timing tests indicate getting new instance is 19% faster than cloning
-        final Calendar cal= Calendar.getInstance(timeZone, locale);
+        final Calendar cal = Calendar.getInstance(timeZone, locale);
         cal.clear();
         cal.setLenient(lenient);
 
-        for(int i=0; i<strategies.length;) {
-            final Strategy strategy= strategies[i++];
+        for (int i = 0; i < strategies.length;) {
+            final Strategy strategy = strategies[i++];
             strategy.setCalendar(this, cal, matcher.group(i));
         }
-        pos.setIndex(offset+matcher.end());
+        pos.setIndex(offset + matcher.end());
         return cal.getTime();
     }
 
     // Support for strategies
-    //-----------------------------------------------------------------------
+    // -----------------------------------------------------------------------
 
     private static StringBuilder simpleQuote(final StringBuilder sb, final String value) {
-        for(int i= 0; i<value.length(); ++i) {
-            final char c= value.charAt(i);
-            switch(c) {
+        for (int i = 0; i < value.length(); ++i) {
+            final char c = value.charAt(i);
+            switch (c) {
             case '\\':
             case '^':
             case '$':
@@ -364,6 +430,7 @@ public class FastDateParser implements DateParser, Serializable {
 
     /**
      * Escape constant fields into regular expression
+     * 
      * @param regex The destination regex
      * @param value The source field
      * @param unquote If true, replace two success quotes ('') with single quote (')
@@ -371,33 +438,33 @@ public class FastDateParser implements DateParser, Serializable {
      */
     private static StringBuilder escapeRegex(final StringBuilder regex, final String value, final boolean unquote) {
         regex.append("\\Q");
-        for(int i= 0; i<value.length(); ++i) {
-            char c= value.charAt(i);
-            switch(c) {
+        for (int i = 0; i < value.length(); ++i) {
+            char c = value.charAt(i);
+            switch (c) {
             case '\'':
-                if(unquote) {
-                    if(++i==value.length()) {
+                if (unquote) {
+                    if (++i == value.length()) {
                         return regex;
                     }
-                    c= value.charAt(i);
+                    c = value.charAt(i);
                 }
                 break;
             case '\\':
-                if(++i==value.length()) {
+                if (++i == value.length()) {
                     break;
                 }
                 /*
-                 * If we have found \E, we replace it with \E\\E\Q, i.e. we stop the quoting,
-                 * quote the \ in \E, then restart the quoting.
-                 *
-                 * Otherwise we just output the two characters.
-                 * In each case the initial \ needs to be output and the final char is done at the end
+                 * If we have found \E, we replace it with \E\\E\Q, i.e. we stop the quoting, quote the \ in \E, then
+                 * restart the quoting.
+                 * 
+                 * Otherwise we just output the two characters. In each case the initial \ needs to be output and the
+                 * final char is done at the end
                  */
                 regex.append(c); // we always want the original \
                 c = value.charAt(i); // Is it followed by E ?
                 if (c == 'E') { // \E detected
-                  regex.append("E\\\\E\\"); // see comment above
-                  c = 'Q'; // appended below
+                    regex.append("E\\\\E\\"); // see comment above
+                    c = 'Q'; // appended below
                 }
                 break;
             default:
@@ -409,38 +476,42 @@ public class FastDateParser implements DateParser, Serializable {
         return regex;
     }
 
-
     /**
      * Get the short and long values displayed for a field
+     * 
      * @param field The field of interest
      * @param definingCalendar The calendar to obtain the short and long values
      * @param locale The locale of display names
      * @return A Map of the field key / value pairs
      */
-    private static Map<String, Integer> getDisplayNames(final int field, final Calendar definingCalendar, final Locale locale) {
+    private static Map<String, Integer> getDisplayNames(final int field, final Calendar definingCalendar,
+            final Locale locale) {
         return definingCalendar.getDisplayNames(field, Calendar.ALL_STYLES, locale);
     }
 
     /**
      * Adjust dates to be within appropriate century
+     * 
      * @param twoDigitYear The year to adjust
      * @return A value between centuryStart(inclusive) to centuryStart+100(exclusive)
      */
     private int adjustYear(final int twoDigitYear) {
-        final int trial= century + twoDigitYear;
-        return twoDigitYear>=startYear ?trial :trial+100;
+        final int trial = century + twoDigitYear;
+        return twoDigitYear >= startYear ? trial : trial + 100;
     }
 
     /**
      * Is the next field a number?
+     * 
      * @return true, if next field will be a number
      */
     boolean isNextNumber() {
-        return nextStrategy!=null && nextStrategy.isNumber();
+        return nextStrategy != null && nextStrategy.isNumber();
     }
 
     /**
      * What is the width of the current field?
+     * 
      * @return The number of characters in the current format field
      */
     int getFieldWidth() {
@@ -451,17 +522,16 @@ public class FastDateParser implements DateParser, Serializable {
      * A strategy to parse a single field from the parsing pattern
      */
     private static abstract class Strategy {
-        
+
         /**
-         * Is this field a number?
-         * The default implementation returns false.
+         * Is this field a number? The default implementation returns false.
          *
          * @return true, if field is a number
          */
         boolean isNumber() {
             return false;
         }
-        
+
         /**
          * Set the Calendar with the parsed field.
          *
@@ -474,14 +544,14 @@ public class FastDateParser implements DateParser, Serializable {
         void setCalendar(final FastDateParser parser, final Calendar cal, final String value) {
 
         }
-        
+
         /**
-         * Generate a <code>Pattern</code> regular expression to the <code>StringBuilder</code>
-         * which will accept this field
+         * Generate a <code>Pattern</code> regular expression to the <code>StringBuilder</code> which will accept this
+         * field
+         * 
          * @param parser The parser calling this strategy
          * @param regex The <code>StringBuilder</code> to append to
-         * @return true, if this field will set the calendar;
-         * false, if this field is a constant value
+         * @return true, if this field will set the calendar; false, if this field is a constant value
          */
         abstract boolean addRegex(FastDateParser parser, StringBuilder regex);
 
@@ -490,20 +560,21 @@ public class FastDateParser implements DateParser, Serializable {
     /**
      * A <code>Pattern</code> to parse the user supplied SimpleDateFormat pattern
      */
-    private static final Pattern formatPattern= Pattern.compile(
-            "D+|E+|F+|G+|H+|K+|M+|S+|W+|X+|Z+|a+|d+|h+|k+|m+|s+|w+|y+|z+|''|'[^']++(''[^']*+)*+'|[^'A-Za-z]++");
+    private static final Pattern formatPattern = Pattern
+            .compile("D+|E+|F+|G+|H+|K+|M+|S+|W+|X+|Z+|a+|d+|h+|k+|m+|s+|w+|y+|z+|''|'[^']++(''[^']*+)*+'|[^'A-Za-z]++");
 
     /**
      * Obtain a Strategy given a field from a SimpleDateFormat pattern
+     * 
      * @param formatField A sub-sequence of the SimpleDateFormat pattern
      * @param definingCalendar The calendar to obtain the short and long values
      * @return The Strategy that will handle parsing for the field
      */
     private Strategy getStrategy(final String formatField, final Calendar definingCalendar) {
-        switch(formatField.charAt(0)) {
+        switch (formatField.charAt(0)) {
         case '\'':
-            if(formatField.length()>2) {
-                return new CopyQuotedStrategy(formatField.substring(1, formatField.length()-1));
+            if (formatField.length() > 2) {
+                return new CopyQuotedStrategy(formatField.substring(1, formatField.length() - 1));
             }
             //$FALL-THROUGH$
         default:
@@ -516,12 +587,13 @@ public class FastDateParser implements DateParser, Serializable {
             return DAY_OF_WEEK_IN_MONTH_STRATEGY;
         case 'G':
             return getLocaleSpecificStrategy(Calendar.ERA, definingCalendar);
-        case 'H':  // Hour in day (0-23)
+        case 'H': // Hour in day (0-23)
             return HOUR_OF_DAY_STRATEGY;
-        case 'K':  // Hour in am/pm (0-11) 
+        case 'K': // Hour in am/pm (0-11)
             return HOUR_STRATEGY;
         case 'M':
-            return formatField.length()>=3 ?getLocaleSpecificStrategy(Calendar.MONTH, definingCalendar) :NUMBER_MONTH_STRATEGY;
+            return formatField.length() >= 3 ? getLocaleSpecificStrategy(Calendar.MONTH, definingCalendar)
+                    : NUMBER_MONTH_STRATEGY;
         case 'S':
             return MILLISECOND_STRATEGY;
         case 'W':
@@ -530,9 +602,9 @@ public class FastDateParser implements DateParser, Serializable {
             return getLocaleSpecificStrategy(Calendar.AM_PM, definingCalendar);
         case 'd':
             return DAY_OF_MONTH_STRATEGY;
-        case 'h':  // Hour in am/pm (1-12), i.e. midday/midnight is 12, not 0
+        case 'h': // Hour in am/pm (1-12), i.e. midday/midnight is 12, not 0
             return HOUR12_STRATEGY;
-        case 'k':  // Hour in day (1-24), i.e. midnight is 24, not 0
+        case 'k': // Hour in day (1-24), i.e. midnight is 24, not 0
             return HOUR24_OF_DAY_STRATEGY;
         case 'm':
             return MINUTE_STRATEGY;
@@ -541,7 +613,7 @@ public class FastDateParser implements DateParser, Serializable {
         case 'w':
             return WEEK_OF_YEAR_STRATEGY;
         case 'y':
-            return formatField.length()>2 ?LITERAL_YEAR_STRATEGY :ABBREVIATED_YEAR_STRATEGY;
+            return formatField.length() > 2 ? LITERAL_YEAR_STRATEGY : ABBREVIATED_YEAR_STRATEGY;
         case 'X':
             return ISO8601TimeZoneStrategy.getStrategy(formatField.length());
         case 'Z':
@@ -554,18 +626,20 @@ public class FastDateParser implements DateParser, Serializable {
         }
     }
 
-    @SuppressWarnings("unchecked") // OK because we are creating an array with no entries
+    @SuppressWarnings("unchecked")
+    // OK because we are creating an array with no entries
     private static final ConcurrentMap<Locale, Strategy>[] caches = new ConcurrentMap[Calendar.FIELD_COUNT];
 
     /**
      * Get a cache of Strategies for a particular field
+     * 
      * @param field The Calendar field
      * @return a cache of Locale to Strategy
      */
     private static ConcurrentMap<Locale, Strategy> getCache(final int field) {
-        synchronized(caches) {
-            if(caches[field]==null) {
-                caches[field]= new ConcurrentHashMap<Locale,Strategy>(3);
+        synchronized (caches) {
+            if (caches[field] == null) {
+                caches[field] = new ConcurrentHashMap<Locale, Strategy>(3);
             }
             return caches[field];
         }
@@ -573,19 +647,19 @@ public class FastDateParser implements DateParser, Serializable {
 
     /**
      * Construct a Strategy that parses a Text field
+     * 
      * @param field The Calendar field
      * @param definingCalendar The calendar to obtain the short and long values
      * @return a TextStrategy for the field and Locale
      */
     private Strategy getLocaleSpecificStrategy(final int field, final Calendar definingCalendar) {
-        final ConcurrentMap<Locale,Strategy> cache = getCache(field);
-        Strategy strategy= cache.get(locale);
-        if(strategy==null) {
-            strategy= field==Calendar.ZONE_OFFSET
-                    ? new TimeZoneStrategy(locale)
-                    : new CaseInsensitiveTextStrategy(field, definingCalendar, locale);
-            final Strategy inCache= cache.putIfAbsent(locale, strategy);
-            if(inCache!=null) {
+        final ConcurrentMap<Locale, Strategy> cache = getCache(field);
+        Strategy strategy = cache.get(locale);
+        if (strategy == null) {
+            strategy = field == Calendar.ZONE_OFFSET ? new TimeZoneStrategy(locale) : new CaseInsensitiveTextStrategy(
+                    field, definingCalendar, locale);
+            final Strategy inCache = cache.putIfAbsent(locale, strategy);
+            if (inCache != null) {
                 return inCache;
             }
         }
@@ -600,10 +674,11 @@ public class FastDateParser implements DateParser, Serializable {
 
         /**
          * Construct a Strategy that ensures the formatField has literal text
+         * 
          * @param formatField The literal text to match
          */
         CopyQuotedStrategy(final String formatField) {
-            this.formatField= formatField;
+            this.formatField = formatField;
         }
 
         /**
@@ -611,9 +686,9 @@ public class FastDateParser implements DateParser, Serializable {
          */
         @Override
         boolean isNumber() {
-            char c= formatField.charAt(0);
-            if(c=='\'') {
-                c= formatField.charAt(1);
+            char c = formatField.charAt(0);
+            if (c == '\'') {
+                c = formatField.charAt(1);
             }
             return Character.isDigit(c);
         }
@@ -631,24 +706,25 @@ public class FastDateParser implements DateParser, Serializable {
     /**
      * A strategy that handles a text field in the parsing pattern
      */
-     private static class CaseInsensitiveTextStrategy extends Strategy {
+    private static class CaseInsensitiveTextStrategy extends Strategy {
         private final int field;
         private final Locale locale;
         private final Map<String, Integer> lKeyValues;
 
         /**
          * Construct a Strategy that parses a Text field
-         * @param field  The Calendar field
-         * @param definingCalendar  The Calendar to use
-         * @param locale  The Locale to use
+         * 
+         * @param field The Calendar field
+         * @param definingCalendar The Calendar to use
+         * @param locale The Locale to use
          */
         CaseInsensitiveTextStrategy(final int field, final Calendar definingCalendar, final Locale locale) {
-            this.field= field;
-            this.locale= locale;
+            this.field = field;
+            this.locale = locale;
             final Map<String, Integer> keyValues = getDisplayNames(field, definingCalendar, locale);
-            this.lKeyValues= new HashMap<String,Integer>();
+            this.lKeyValues = new HashMap<String, Integer>();
 
-            for(final Map.Entry<String, Integer> entry : keyValues.entrySet()) {
+            for (final Map.Entry<String, Integer> entry : keyValues.entrySet()) {
                 lKeyValues.put(entry.getKey().toLowerCase(locale), entry.getValue());
             }
         }
@@ -659,10 +735,10 @@ public class FastDateParser implements DateParser, Serializable {
         @Override
         boolean addRegex(final FastDateParser parser, final StringBuilder regex) {
             regex.append("((?iu)");
-            for(final String textKeyValue : lKeyValues.keySet()) {
+            for (final String textKeyValue : lKeyValues.keySet()) {
                 simpleQuote(regex, textKeyValue).append('|');
             }
-            regex.setCharAt(regex.length()-1, ')');
+            regex.setCharAt(regex.length() - 1, ')');
             return true;
         }
 
@@ -672,20 +748,19 @@ public class FastDateParser implements DateParser, Serializable {
         @Override
         void setCalendar(final FastDateParser parser, final Calendar cal, final String value) {
             final Integer iVal = lKeyValues.get(value.toLowerCase(locale));
-            if(iVal == null) {
-                final StringBuilder sb= new StringBuilder(value);
+            if (iVal == null) {
+                final StringBuilder sb = new StringBuilder(value);
                 sb.append(" not in (");
-                for(final String textKeyValue : lKeyValues.keySet()) {
+                for (final String textKeyValue : lKeyValues.keySet()) {
                     sb.append(textKeyValue).append(' ');
                 }
-                sb.setCharAt(sb.length()-1, ')');
+                sb.setCharAt(sb.length() - 1, ')');
                 throw new IllegalArgumentException(sb.toString());
             }
             cal.set(field, iVal.intValue());
         }
     }
 
-
     /**
      * A strategy that handles a number field in the parsing pattern
      */
@@ -694,10 +769,11 @@ public class FastDateParser implements DateParser, Serializable {
 
         /**
          * Construct a Strategy that parses a Number field
+         * 
          * @param field The Calendar field
          */
         NumberStrategy(final int field) {
-             this.field= field;
+            this.field = field;
         }
 
         /**
@@ -714,10 +790,9 @@ public class FastDateParser implements DateParser, Serializable {
         @Override
         boolean addRegex(final FastDateParser parser, final StringBuilder regex) {
             // See LANG-954: We use {Nd} rather than {IsNd} because Android does not support the Is prefix
-            if(parser.isNextNumber()) {
+            if (parser.isNextNumber()) {
                 regex.append("(\\p{Nd}{").append(parser.getFieldWidth()).append("}+)");
-            }
-            else {
+            } else {
                 regex.append("(\\p{Nd}++)");
             }
             return true;
@@ -733,6 +808,7 @@ public class FastDateParser implements DateParser, Serializable {
 
         /**
          * Make any modifications to parsed integer
+         * 
          * @param iValue The parsed integer
          * @return The modified value
          */
@@ -741,29 +817,15 @@ public class FastDateParser implements DateParser, Serializable {
         }
     }
 
-    private static final Strategy ABBREVIATED_YEAR_STRATEGY = new NumberStrategy(Calendar.YEAR) {
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        void setCalendar(final FastDateParser parser, final Calendar cal, final String value) {
-            int iValue= Integer.parseInt(value);
-            if(iValue<100) {
-                iValue= parser.adjustYear(iValue);
-            }
-            cal.set(Calendar.YEAR, iValue);
-        }
-    };
-
     /**
      * A strategy that handles a timezone field in the parsing pattern
      */
     static class TimeZoneStrategy extends Strategy {
         private static final String RFC_822_TIME_ZONE = "[+-]\\d{4}";
-        private static final String GMT_OPTION= "GMT[+-]\\d{1,2}:\\d{2}";
-        
+        private static final String GMT_OPTION = "GMT[+-]\\d{1,2}:\\d{2}";
+
         private final Locale locale;
-        private final Map<String, TimeZone> tzNames= new HashMap<String, TimeZone>();
+        private final Map<String, TimeZone> tzNames = new HashMap<String, TimeZone>();
         private final String validTimeZoneChars;
 
         /**
@@ -773,13 +835,14 @@ public class FastDateParser implements DateParser, Serializable {
 
         /**
          * Construct a Strategy that parses a TimeZone
+         * 
          * @param locale The Locale
          */
         TimeZoneStrategy(final Locale locale) {
             this.locale = locale;
 
             final StringBuilder sb = new StringBuilder();
-            sb.append('(' + RFC_822_TIME_ZONE + "|(?iu)" + GMT_OPTION );
+            sb.append('(' + RFC_822_TIME_ZONE + "|(?iu)" + GMT_OPTION);
 
             final String[][] zones = DateFormatSymbols.getInstance(locale).getZoneStrings();
             for (final String[] zoneNames : zones) {
@@ -788,9 +851,9 @@ public class FastDateParser implements DateParser, Serializable {
                     continue;
                 }
                 final TimeZone tz = TimeZone.getTimeZone(tzId);
-                for(int i= 1; i<zoneNames.length; ++i) {
+                for (int i = 1; i < zoneNames.length; ++i) {
                     final String zoneName = zoneNames[i].toLowerCase(locale);
-                    if (!tzNames.containsKey(zoneName)){
+                    if (!tzNames.containsKey(zoneName)) {
                         tzNames.put(zoneName, tz);
                         simpleQuote(sb.append('|'), zoneName);
                     }
@@ -816,34 +879,33 @@ public class FastDateParser implements DateParser, Serializable {
         @Override
         void setCalendar(final FastDateParser parser, final Calendar cal, final String value) {
             TimeZone tz;
-            if(value.charAt(0)=='+' || value.charAt(0)=='-') {
-                tz= TimeZone.getTimeZone("GMT"+value);
-            }
-            else if(value.regionMatches(true, 0, "GMT", 0, 3)) {
-                tz= TimeZone.getTimeZone(value.toUpperCase());
-            }
-            else {
-                tz= tzNames.get(value.toLowerCase(locale));
-                if(tz==null) {
+            if (value.charAt(0) == '+' || value.charAt(0) == '-') {
+                tz = TimeZone.getTimeZone("GMT" + value);
+            } else if (value.regionMatches(true, 0, "GMT", 0, 3)) {
+                tz = TimeZone.getTimeZone(value.toUpperCase());
+            } else {
+                tz = tzNames.get(value.toLowerCase(locale));
+                if (tz == null) {
                     throw new IllegalArgumentException(value + " is not a supported timezone name");
                 }
             }
             cal.setTimeZone(tz);
         }
     }
-    
+
     private static class ISO8601TimeZoneStrategy extends Strategy {
-        // Z, +hh, -hh, +hhmm, -hhmm, +hh:mm or -hh:mm 
+        // Z, +hh, -hh, +hhmm, -hhmm, +hh:mm or -hh:mm
         private final String pattern;
 
         /**
          * Construct a Strategy that parses a TimeZone
+         * 
          * @param pattern The Pattern
          */
         ISO8601TimeZoneStrategy(final String pattern) {
             this.pattern = pattern;
         }
-        
+
         /**
          * {@inheritDoc}
          */
@@ -852,7 +914,7 @@ public class FastDateParser implements DateParser, Serializable {
             regex.append(pattern);
             return true;
         }
-        
+
         /**
          * {@inheritDoc}
          */
@@ -864,7 +926,7 @@ public class FastDateParser implements DateParser, Serializable {
                 cal.setTimeZone(TimeZone.getTimeZone("GMT" + value));
             }
         }
-        
+
         private static final Strategy ISO_8601_1_STRATEGY = new ISO8601TimeZoneStrategy("(Z|(?:[+-]\\d{2}))");
         private static final Strategy ISO_8601_2_STRATEGY = new ISO8601TimeZoneStrategy("(Z|(?:[+-]\\d{2}\\d{2}))");
         private static final Strategy ISO_8601_3_STRATEGY = new ISO8601TimeZoneStrategy("(Z|(?:[+-]\\d{2}(?::)\\d{2}))");
@@ -874,10 +936,10 @@ public class FastDateParser implements DateParser, Serializable {
          * 
          * @param tokenLen a token indicating the length of the TimeZone String to be formatted.
          * @return a ISO8601TimeZoneStrategy that can format TimeZone String of length {@code tokenLen}. If no such
-         *          strategy exists, an IllegalArgumentException will be thrown.
+         *         strategy exists, an IllegalArgumentException will be thrown.
          */
         static Strategy getStrategy(final int tokenLen) {
-            switch(tokenLen) {
+            switch (tokenLen) {
             case 1:
                 return ISO_8601_1_STRATEGY;
             case 2:
@@ -890,36 +952,4 @@ public class FastDateParser implements DateParser, Serializable {
         }
     }
 
-    private static final Strategy NUMBER_MONTH_STRATEGY = new NumberStrategy(Calendar.MONTH) {
-        @Override
-        int modify(final int iValue) {
-            return iValue-1;
-        }
-    };
-    private static final Strategy LITERAL_YEAR_STRATEGY = new NumberStrategy(Calendar.YEAR);
-    private static final Strategy WEEK_OF_YEAR_STRATEGY = new NumberStrategy(Calendar.WEEK_OF_YEAR);
-    private static final Strategy WEEK_OF_MONTH_STRATEGY = new NumberStrategy(Calendar.WEEK_OF_MONTH);
-    private static final Strategy DAY_OF_YEAR_STRATEGY = new NumberStrategy(Calendar.DAY_OF_YEAR);
-    private static final Strategy DAY_OF_MONTH_STRATEGY = new NumberStrategy(Calendar.DAY_OF_MONTH);
-    private static final Strategy DAY_OF_WEEK_IN_MONTH_STRATEGY = new NumberStrategy(Calendar.DAY_OF_WEEK_IN_MONTH);
-    private static final Strategy HOUR_OF_DAY_STRATEGY = new NumberStrategy(Calendar.HOUR_OF_DAY);
-    private static final Strategy HOUR24_OF_DAY_STRATEGY = new NumberStrategy(Calendar.HOUR_OF_DAY) {
-        @Override
-        int modify(final int iValue) {
-            return iValue == 24 ? 0 : iValue;
-        }
-    };
-    private static final Strategy HOUR12_STRATEGY = new NumberStrategy(Calendar.HOUR) {
-        @Override
-        int modify(final int iValue) {
-            return iValue == 12 ? 0 : iValue;
-        }
-    };
-    private static final Strategy HOUR_STRATEGY = new NumberStrategy(Calendar.HOUR);
-    private static final Strategy MINUTE_STRATEGY = new NumberStrategy(Calendar.MINUTE);
-    private static final Strategy SECOND_STRATEGY = new NumberStrategy(Calendar.SECOND);
-    private static final Strategy MILLISECOND_STRATEGY = new NumberStrategy(Calendar.MILLISECOND);
-    private static final Strategy ISO_8601_STRATEGY = new ISO8601TimeZoneStrategy("(Z|(?:[+-]\\d{2}(?::?\\d{2})?))");
-
-
 }