You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by ca...@apache.org on 2006/03/28 20:44:29 UTC

svn commit: r389572 - in /logging/log4j/trunk: src/java/org/apache/log4j/helpers/DateTimeDateFormat.java src/java/org/apache/log4j/helpers/ISO8601DateFormat.java tests/src/java/org/apache/log4j/helpers/DateLayoutTest.java

Author: carnold
Date: Tue Mar 28 10:44:24 2006
New Revision: 389572

URL: http://svn.apache.org/viewcvs?rev=389572&view=rev
Log:
Bug 39135: Bad patterns in ISO8601DateFormat and DateTimeDateFormat

Modified:
    logging/log4j/trunk/src/java/org/apache/log4j/helpers/DateTimeDateFormat.java
    logging/log4j/trunk/src/java/org/apache/log4j/helpers/ISO8601DateFormat.java
    logging/log4j/trunk/tests/src/java/org/apache/log4j/helpers/DateLayoutTest.java

Modified: logging/log4j/trunk/src/java/org/apache/log4j/helpers/DateTimeDateFormat.java
URL: http://svn.apache.org/viewcvs/logging/log4j/trunk/src/java/org/apache/log4j/helpers/DateTimeDateFormat.java?rev=389572&r1=389571&r2=389572&view=diff
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/helpers/DateTimeDateFormat.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/helpers/DateTimeDateFormat.java Tue Mar 28 10:44:24 2006
@@ -21,7 +21,7 @@
 import java.text.DateFormatSymbols;
 
 /**
- * Formats a {@link Date} in the format "dd MMM YYYY HH:mm:ss,SSS" for example,
+ * Formats a {@link Date} in the format "dd MMM yyyy HH:mm:ss,SSS" for example,
  * "06 Nov 1994 15:49:37,459".
  *
  * @author Ceki Gülcü
@@ -32,7 +32,7 @@
     /**
      * Equivalent format string for SimpleDateFormat.
      */
-    private final static String PATTERN = "dd MMM YYYY HH:mm:ss,SSS";
+    private final static String PATTERN = "dd MMM yyyy HH:mm:ss,SSS";
     /** Short names for the months. */
     String[] shortMonths = new DateFormatSymbols().getShortMonths();
 

Modified: logging/log4j/trunk/src/java/org/apache/log4j/helpers/ISO8601DateFormat.java
URL: http://svn.apache.org/viewcvs/logging/log4j/trunk/src/java/org/apache/log4j/helpers/ISO8601DateFormat.java?rev=389572&r1=389571&r2=389572&view=diff
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/helpers/ISO8601DateFormat.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/helpers/ISO8601DateFormat.java Tue Mar 28 10:44:24 2006
@@ -21,7 +21,7 @@
 // Contributors: Arndt Schoenewald <ar...@ibm23093i821.mc.schoenewald.de>
 
 /**
- * Formats a {@link java.util.Date} in the format "YYYY-mm-dd HH:mm:ss,SSS" for example
+ * Formats a {@link java.util.Date} in the format "yyyy-MM-dd HH:mm:ss,SSS" for example
  * "1999-11-27 15:49:37,459".
  * <p/>
  * <p>Refer to the <a
@@ -38,7 +38,7 @@
     /**
      * Equivalent format string for SimpleDateFormat.
      */
-    private static final String FORMAT = "YYYY-mm-dd HH:mm:ss,SSS";
+    private static final String FORMAT = "yyyy-MM-dd HH:mm:ss,SSS";
 
     /**
      * Create a new instance of ISO8601DateFormat.
@@ -52,7 +52,7 @@
      *
      * @param timeZone time zone used in conversion, may not be null.
      */
-    public ISO8601DateFormat(TimeZone timeZone) {
+    public ISO8601DateFormat(final TimeZone timeZone) {
         super(FORMAT, timeZone);
     }
 

Modified: logging/log4j/trunk/tests/src/java/org/apache/log4j/helpers/DateLayoutTest.java
URL: http://svn.apache.org/viewcvs/logging/log4j/trunk/tests/src/java/org/apache/log4j/helpers/DateLayoutTest.java?rev=389572&r1=389571&r2=389572&view=diff
==============================================================================
--- logging/log4j/trunk/tests/src/java/org/apache/log4j/helpers/DateLayoutTest.java (original)
+++ logging/log4j/trunk/tests/src/java/org/apache/log4j/helpers/DateLayoutTest.java Tue Mar 28 10:44:24 2006
@@ -24,6 +24,7 @@
 import java.text.SimpleDateFormat;
 
 import java.util.TimeZone;
+import java.util.Date;
 
 
 /**
@@ -228,6 +229,27 @@
     DateLayout layout = (DateLayout) createLayout();
     layout.setDateFormat(format, TimeZone.getDefault());
   }
+
+    /**
+     * Tests IS08601DateFormat class.
+     * @deprecated since ISO8601DateFormat is deprecated
+     */
+  public void testISO8601Format() {
+      DateFormat format = new ISO8601DateFormat();
+      String actual = format.format(new Date(-TimeZone.getDefault().getOffset(0)));
+      assertEquals("1970-01-01 00:00:00,000", actual);
+  }
+
+    /**
+     * Tests DateTimeDateFormat class.
+     * @deprecated since DateTimeDateFormat is deprecated
+     */
+  public void testDateTimeFormat() {
+      DateFormat format = new DateTimeDateFormat();
+      String actual = format.format(new Date(-TimeZone.getDefault().getOffset(0)));
+      assertEquals("01 Jan 1970 00:00:00,000", actual);
+  }
+
 
   /**
    * Concrete Layout class for tests.



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org