james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1526148 - in /james/mime4j/trunk/dom/src: main/java/org/apache/james/mime4j/field/DateTimeFieldLenientImpl.java test/java/org/apache/james/mime4j/field/LenientDateTimeFieldTest.java
Date Wed, 25 Sep 2013 10:16:56 GMT
Author: olegk
Date: Wed Sep 25 10:16:56 2013
New Revision: 1526148

URL: http://svn.apache.org/r1526148
Log:
MIME4J-232: Problem paring date with extra leading space(s)
Contributed by Lukas Vlcek <lukas.vlcek at gmail.com>

Modified:
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/DateTimeFieldLenientImpl.java
    james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/LenientDateTimeFieldTest.java

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/DateTimeFieldLenientImpl.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/DateTimeFieldLenientImpl.java?rev=1526148&r1=1526147&r2=1526148&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/DateTimeFieldLenientImpl.java
(original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/DateTimeFieldLenientImpl.java
Wed Sep 25 10:16:56 2013
@@ -71,6 +71,9 @@ public class DateTimeFieldLenientImpl ex
         parsed = true;
         date = null;
         String body = getBody();
+        if (body != null) {
+            body = body.trim();
+        }
         for (String datePattern : datePatterns) {
             try {
                 SimpleDateFormat parser = new SimpleDateFormat(datePattern, Locale.US);

Modified: james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/LenientDateTimeFieldTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/LenientDateTimeFieldTest.java?rev=1526148&r1=1526147&r2=1526148&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/LenientDateTimeFieldTest.java
(original)
+++ james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/LenientDateTimeFieldTest.java
Wed Sep 25 10:16:56 2013
@@ -62,4 +62,10 @@ public class LenientDateTimeFieldTest {
         Assert.assertEquals(1342563815882L, f.getDate().getTime());
     }
 
+    @Test
+    public void testDateWithExtraLeadingWhiteSpace() throws Exception {
+        DateTimeField f = parse("Date:  Wed, 28 Mar 2007 13:32:39 +1000");
+        Assert.assertEquals(1175052759000L, f.getDate().getTime());
+    }
+
 }



Mime
View raw message