james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r647588 - in /james/server/trunk: experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/ imap-codec-library/src/main/java/org/apache/james/imapserver/codec/decode/ imap-codec-library/src/test/java/...
Date Sun, 13 Apr 2008 16:59:20 GMT
Author: rdonkin
Date: Sun Apr 13 09:59:15 2008
New Revision: 647588

URL: http://svn.apache.org/viewvc?rev=647588&view=rev
Log:
Apple Mail uses '0' not ' ' when prefixing APPEND dates.

Modified:
    james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/Append.test
    james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imapserver/codec/decode/DecoderUtils.java
    james/server/trunk/imap-codec-library/src/test/java/org/apache/james/imapserver/codec/decode/DecoderUtilsTest.java

Modified: james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/Append.test
URL: http://svn.apache.org/viewvc/james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/Append.test?rev=647588&r1=647587&r2=647588&view=diff
==============================================================================
--- james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/Append.test
(original)
+++ james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/Append.test
Sun Apr 13 09:59:15 2008
@@ -52,5 +52,18 @@
 C: 13 characters
 S: a1 NO \[TRYCREATE\] APPEND failed\. No such mailbox\.
 
+C: 5.25 APPEND appendBox (\Seen \Draft) "09-Apr-2008 15:17:51 +0200" {310+}
+C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
+C: From: Fred Foobar <foobar@Blurdybloop.COM>
+C: Subject: afternoon meeting 2
+C: To: mooch@owatagu.siam.edu
+C: Message-Id: <B27397-0100000@Blurdybloop.COM>
+C: MIME-Version: 1.0
+C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
+C:
+C: Hello Joe, could we change that to 4:00pm tomorrow?
+C:
+S: 5.25 OK APPEND completed.
+
 C: a1 DELETE appendBox
 S: a1 OK DELETE completed.

Modified: james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imapserver/codec/decode/DecoderUtils.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imapserver/codec/decode/DecoderUtils.java?rev=647588&r1=647587&r2=647588&view=diff
==============================================================================
--- james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imapserver/codec/decode/DecoderUtils.java
(original)
+++ james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imapserver/codec/decode/DecoderUtils.java
Sun Apr 13 09:59:15 2008
@@ -399,16 +399,14 @@
 
     public static int decodeFixedDay(final char dayHigh, final char dayLow) throws ProtocolException
{
         int result = decodeDigit(dayLow);
-        if (dayHigh == '1') {
-            result += 10;
-        } else if (dayHigh == '2') {
-            result += 20;
-        } else if (dayHigh == '3') {
-            result += 30;
-        } else if (dayHigh != ' ') {
-            throw new ProtocolException("Expected SP, 1, 2, or 3 but was " + dayHigh);
+        switch (dayHigh) {
+            case '0': return result;
+            case '1': return result += 10;
+            case '2': return result += 20;
+            case '3': return result += 30;
+            case ' ': return result;
         }
-        return result;
+        throw new ProtocolException("Expected SP, 0, 1, 2, or 3 but was " + dayHigh);
     }
     
     /**

Modified: james/server/trunk/imap-codec-library/src/test/java/org/apache/james/imapserver/codec/decode/DecoderUtilsTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-codec-library/src/test/java/org/apache/james/imapserver/codec/decode/DecoderUtilsTest.java?rev=647588&r1=647587&r2=647588&view=diff
==============================================================================
--- james/server/trunk/imap-codec-library/src/test/java/org/apache/james/imapserver/codec/decode/DecoderUtilsTest.java
(original)
+++ james/server/trunk/imap-codec-library/src/test/java/org/apache/james/imapserver/codec/decode/DecoderUtilsTest.java
Sun Apr 13 09:59:15 2008
@@ -140,6 +140,10 @@
         assertEquals("20 Oct 1972 20:00:00 GMT", DecoderUtils.decodeDateTime("21-Oct-1972
06:00:00 +1000").toGMTString());
         assertEquals("21 Oct 1972 16:00:00 GMT", DecoderUtils.decodeDateTime("21-Oct-1972
06:00:00 -1000").toGMTString());
     }
+
+    public void testAppleMailPrependsZeroNotSpace() throws Exception {
+        assertEquals("9 Apr 2008 13:17:51 GMT", DecoderUtils.decodeDateTime("09-Apr-2008
15:17:51 +0200").toGMTString());
+    }
     
     public void testDecodeDateTime() throws Exception {
         runTimeZoneTest(TimeZone.getTimeZone("GMT+0"));



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


Mime
View raw message