logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1405269 - /logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/DatePatternConverter.java
Date Sat, 03 Nov 2012 02:54:41 GMT
Author: ggregory
Date: Sat Nov  3 02:54:41 2012
New Revision: 1405269

URL: http://svn.apache.org/viewvc?rev=1405269&view=rev
Log:
Make some ivars final.

Modified:
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/DatePatternConverter.java

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/DatePatternConverter.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/DatePatternConverter.java?rev=1405269&r1=1405268&r2=1405269&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/DatePatternConverter.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/DatePatternConverter.java
Sat Nov  3 02:54:41 2012
@@ -88,7 +88,7 @@ public final class DatePatternConverter 
 
     private long lastTimestamp;
 
-    private SimpleDateFormat simpleFormat;
+    private final SimpleDateFormat simpleFormat;
 
     /**
      * Private constructor.
@@ -124,20 +124,23 @@ public final class DatePatternConverter 
             pattern = patternOption;
         }
 
+        SimpleDateFormat tempFormat;
+        
         try {
-            simpleFormat = new SimpleDateFormat(pattern);
+            tempFormat = new SimpleDateFormat(pattern);
         } catch (IllegalArgumentException e) {
             LOGGER.warn("Could not instantiate SimpleDateFormat with pattern " + patternOption,
e);
 
             // default to the ISO8601 format
-            simpleFormat = new SimpleDateFormat(ISO8601_PATTERN);
+            tempFormat = new SimpleDateFormat(ISO8601_PATTERN);
         }
 
         // if the option list contains a TZ option, then set it.
         if ((options != null) && (options.length > 1)) {
             TimeZone tz = TimeZone.getTimeZone(options[1]);
-            simpleFormat.setTimeZone(tz);
+            tempFormat.setTimeZone(tz);
         }
+        simpleFormat = tempFormat; 
     }
 
     /**



Mime
View raw message