cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject svn commit: r264923 - in /cocoon/trunk: src/java/org/apache/cocoon/util/log/CocoonLogFormatter.java status.xml
Date Wed, 31 Aug 2005 02:20:49 GMT
Author: antonio
Date: Tue Aug 30 19:20:43 2005
New Revision: 264923

URL: http://svn.apache.org/viewcvs?rev=264923&view=rev
Log:
Fix 36373: getTime(...) of CocoonLogFormatter implemented incorrectly
Thanks to Johan Stuyts (j.stuyts@hippo.nl)

Modified:
    cocoon/trunk/src/java/org/apache/cocoon/util/log/CocoonLogFormatter.java
    cocoon/trunk/status.xml

Modified: cocoon/trunk/src/java/org/apache/cocoon/util/log/CocoonLogFormatter.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/util/log/CocoonLogFormatter.java?rev=264923&r1=264922&r2=264923&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/util/log/CocoonLogFormatter.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/util/log/CocoonLogFormatter.java Tue Aug 30 19:20:43
2005
@@ -23,12 +23,11 @@
 import org.apache.cocoon.util.ExceptionUtils;
 
 import org.apache.commons.lang.ClassUtils;
+import org.apache.commons.lang.time.FastDateFormat;
 import org.apache.log.ContextMap;
 import org.apache.log.LogEvent;
 import org.apache.log.Logger;
 
-import java.text.SimpleDateFormat;
-import java.util.Date;
 import java.util.Map;
 
 /**
@@ -76,7 +75,7 @@
     protected final static String  TYPE_QUERY_STR       = "query";
     protected final static String  TYPE_ROOTTHROWABLE_STR = "rootThrowable";
 
-    protected final static SimpleDateFormat DATE_FORMATTER = new SimpleDateFormat("(yyyy-MM-dd)
HH:mm.ss:SSS");
+    private static final String DEFAULT_TIME_PATTERN = "(yyyy-MM-dd) HH:mm.ss:SSS";
 
     /**
      * Hack to get the call stack as an array of classes. The
@@ -230,8 +229,7 @@
             final Object context = ctxMap.get("objectModel");
             if (context != null && context instanceof Map) {
                 // Get the request
-                final Request request = ObjectModelHelper
-                        .getRequest((Map) context);
+                final Request request = ObjectModelHelper.getRequest((Map) context);
                 if (request != null) {
                     final String queryString = request.getQueryString();
                     if (queryString != null) {
@@ -300,10 +298,17 @@
      * Utility method to format time.
      *
      * @param time the time
-     * @param format ancilliary format parameter - allowed to be null
+     * @param pattern ancilliary pattern parameter - allowed to be null
      * @return the formatted string
      */
-    protected String getTime(final long time, final String format) {
-        return DATE_FORMATTER.format(new Date());
+    protected String getTime(final long time, String pattern) {
+        String result;
+
+        if (pattern == null) {
+            pattern = DEFAULT_TIME_PATTERN;
+        }
+        FastDateFormat format = FastDateFormat.getInstance(pattern);
+        result = format.format(time);
+        return result;
     }
 }

Modified: cocoon/trunk/status.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/status.xml?rev=264923&r1=264922&r2=264923&view=diff
==============================================================================
--- cocoon/trunk/status.xml (original)
+++ cocoon/trunk/status.xml Tue Aug 30 19:20:43 2005
@@ -530,6 +530,9 @@
    </action>
   </release>
   <release version="2.1.8" date="TBD">
+    <action dev="AG" type="fix" fixes-bug="36373" due-to="Johan Stuyts" due-to-email="j.stuyts@hippo.nl">
+      getTime(...) of CocoonLogFormatter implemented incorrectly
+    </action>
     <action dev="VG" type="update">
       SourceWritingTransformer supports all allowed nodes when using
       <code>source:write</code> to create new document.



Mime
View raw message