cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject svn commit: r266246 - /cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/log/CocoonLogFormatter.java
Date Fri, 02 Sep 2005 03:17:50 GMT
Author: antonio
Date: Thu Sep  1 20:17:44 2005
New Revision: 266246

URL: http://svn.apache.org/viewcvs?rev=266246&view=rev
Log:
Improve FastDateFormat usage. Thanks to Vadim Gritsenko :-)

Modified:
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/log/CocoonLogFormatter.java

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/log/CocoonLogFormatter.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/log/CocoonLogFormatter.java?rev=266246&r1=266245&r2=266246&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/log/CocoonLogFormatter.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/log/CocoonLogFormatter.java
Thu Sep  1 20:17:44 2005
@@ -76,6 +76,7 @@
     protected final static String  TYPE_ROOTTHROWABLE_STR = "rootThrowable";
 
     private static final String DEFAULT_TIME_PATTERN = "(yyyy-MM-dd) HH:mm.ss:SSS";
+    private static final FastDateFormat dateFormatter = FastDateFormat.getInstance(DEFAULT_TIME_PATTERN);
 
     /**
      * Hack to get the call stack as an array of classes. The
@@ -302,13 +303,9 @@
      * @return the formatted string
      */
     protected String getTime(final long time, String pattern) {
-        String result;
-
-        if (pattern == null) {
-            pattern = DEFAULT_TIME_PATTERN;
+        if (pattern == null || DEFAULT_TIME_PATTERN.equals(pattern)) {
+            return dateFormatter.format(time);
         }
-        FastDateFormat format = FastDateFormat.getInstance(pattern);
-        result = format.format(time);
-        return result;
+        return FastDateFormat.getInstance(pattern).format(time);
     }
 }



Mime
View raw message