james-mime4j-dev mailing list archives

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

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

Modified:
    james/mime4j/branches/apache-mime4j-0.7/.gitignore
    james/mime4j/branches/apache-mime4j-0.7/dom/src/main/java/org/apache/james/mime4j/field/DateTimeFieldLenientImpl.java
    james/mime4j/branches/apache-mime4j-0.7/dom/src/test/java/org/apache/james/mime4j/field/LenientDateTimeFieldTest.java

Modified: james/mime4j/branches/apache-mime4j-0.7/.gitignore
URL: http://svn.apache.org/viewvc/james/mime4j/branches/apache-mime4j-0.7/.gitignore?rev=1526147&r1=1526146&r2=1526147&view=diff
==============================================================================
--- james/mime4j/branches/apache-mime4j-0.7/.gitignore (original)
+++ james/mime4j/branches/apache-mime4j-0.7/.gitignore Wed Sep 25 10:09:56 2013
@@ -3,3 +3,5 @@
 .settings
 target
 maven-eclipse.xml
+.idea
+*.iml

Modified: james/mime4j/branches/apache-mime4j-0.7/dom/src/main/java/org/apache/james/mime4j/field/DateTimeFieldLenientImpl.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/apache-mime4j-0.7/dom/src/main/java/org/apache/james/mime4j/field/DateTimeFieldLenientImpl.java?rev=1526147&r1=1526146&r2=1526147&view=diff
==============================================================================
--- james/mime4j/branches/apache-mime4j-0.7/dom/src/main/java/org/apache/james/mime4j/field/DateTimeFieldLenientImpl.java
(original)
+++ james/mime4j/branches/apache-mime4j-0.7/dom/src/main/java/org/apache/james/mime4j/field/DateTimeFieldLenientImpl.java
Wed Sep 25 10:09:56 2013
@@ -72,6 +72,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/branches/apache-mime4j-0.7/dom/src/test/java/org/apache/james/mime4j/field/LenientDateTimeFieldTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/apache-mime4j-0.7/dom/src/test/java/org/apache/james/mime4j/field/LenientDateTimeFieldTest.java?rev=1526147&r1=1526146&r2=1526147&view=diff
==============================================================================
--- james/mime4j/branches/apache-mime4j-0.7/dom/src/test/java/org/apache/james/mime4j/field/LenientDateTimeFieldTest.java
(original)
+++ james/mime4j/branches/apache-mime4j-0.7/dom/src/test/java/org/apache/james/mime4j/field/LenientDateTimeFieldTest.java
Wed Sep 25 10:09:56 2013
@@ -58,4 +58,9 @@ public class LenientDateTimeFieldTest ex
         assertEquals(1342563815882L,f.getDate().getTime());
     }
 
+    public void testDateWithExtraLeadingWhiteSpace() throws Exception {
+        DateTimeField f = parse("Date:  Wed, 28 Mar 2007 13:32:39 +1000");
+        assertEquals(1175052759000L, f.getDate().getTime());
+    }
+
 }



Mime
View raw message