james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r644913 - in /james/server/trunk: experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/ imap-api/src/main/ja...
Date Fri, 04 Apr 2008 20:58:30 GMT
Author: rdonkin
Date: Fri Apr  4 13:58:28 2008
New Revision: 644913

URL: http://svn.apache.org/viewvc?rev=644913&view=rev
Log:
Switch from deprecated to improved fault handling

Removed:
    james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imap/message/response/imap4rev1/legacy/ErrorResponse.java
    james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imapserver/codec/encode/imap4rev1/legacy/ErrorResponseEncoder.java
    james/server/trunk/imap-codec-library/src/test/java/org/apache/james/imapserver/codec/encode/imap4rev1/legacy/ErrorResponseMessageTest.java
Modified:
    james/server/trunk/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/DefaultImapDecoderFactory.java
    james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/Authenticate.test
    james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/Capability.test
    james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/HeaderPartialFetch.test
    james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/Login.test
    james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/Logout.test
    james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/MimePartialFetch.test
    james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/TextPartialFetch.test
    james/server/trunk/imap-api/src/main/java/org/apache/james/api/imap/display/HumanReadableTextKey.java
    james/server/trunk/imap-api/src/main/java/org/apache/james/api/imap/imap4rev1/Imap4Rev1MessageFactory.java
    james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imap/message/request/base/BaseImap4Rev1MessageFactory.java
    james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imapserver/codec/decode/base/AbstractImapCommandParser.java
    james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imapserver/codec/decode/main/DefaultImapDecoder.java
    james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imapserver/codec/encode/main/DefaultImapEncoderFactory.java

Modified: james/server/trunk/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/DefaultImapDecoderFactory.java
URL: http://svn.apache.org/viewvc/james/server/trunk/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/DefaultImapDecoderFactory.java?rev=644913&r1=644912&r2=644913&view=diff
==============================================================================
--- james/server/trunk/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/DefaultImapDecoderFactory.java
(original)
+++ james/server/trunk/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/DefaultImapDecoderFactory.java
Fri Apr  4 13:58:28 2008
@@ -35,11 +35,14 @@
  */
 public class DefaultImapDecoderFactory implements ImapDecoderFactory{
     
+    
+    
     public static final ImapDecoder createDecoder() {
-        final Imap4Rev1MessageFactory messageFactory = new BaseImap4Rev1MessageFactory();
+        final UnpooledStatusResponseFactory unpooledStatusResponseFactory = new UnpooledStatusResponseFactory();
+        final Imap4Rev1MessageFactory messageFactory = new BaseImap4Rev1MessageFactory(unpooledStatusResponseFactory);
         final Imap4Rev1CommandFactory commandFactory = new StandardImap4Rev1CommandFactory();
         final ImapCommandParserFactory imapCommands = new Imap4Rev1CommandParserFactory(
-                messageFactory, commandFactory, new UnpooledStatusResponseFactory());
+                messageFactory, commandFactory, unpooledStatusResponseFactory);
         final ImapDecoder result = new DefaultImapDecoder(messageFactory,
                 imapCommands);
         return result;

Modified: james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/Authenticate.test
URL: http://svn.apache.org/viewvc/james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/Authenticate.test?rev=644913&r1=644912&r2=644913&view=diff
==============================================================================
--- james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/Authenticate.test
(original)
+++ james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/Authenticate.test
Fri Apr  4 13:58:28 2008
@@ -21,7 +21,7 @@
 S: abcd NO AUTHENTICATE failed. Authentication mechanism is unsupported.
 
 C: abcd AUTHENTICATE
-S: abcd BAD Missing argument. Command should be '<tag> AUTHENTICATE <auth_type>
\*\(CRLF base64\)'
+S: abcd BAD AUTHENTICATE failed. Illegal arguments.
 
 C: abcd AUTHENTICATE KERBEROS_V4 extra
-S: abcd BAD Expected end-of-line, found 'e'. Command should be '<tag> AUTHENTICATE
<auth_type> \*\(CRLF base64\)'
+S: abcd BAD AUTHENTICATE failed. Illegal arguments.

Modified: james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/Capability.test
URL: http://svn.apache.org/viewvc/james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/Capability.test?rev=644913&r1=644912&r2=644913&view=diff
==============================================================================
--- james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/Capability.test
(original)
+++ james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/Capability.test
Fri Apr  4 13:58:28 2008
@@ -21,4 +21,4 @@
 S: abcd OK CAPABILITY completed.
 
 C: abcd CAPABILITY extra stuff
-S: abcd BAD Expected end-of-line, found 'e'. Command should be '<tag> CAPABILITY'
\ No newline at end of file
+S: abcd BAD CAPABILITY failed. Illegal arguments.
\ No newline at end of file

Modified: james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/HeaderPartialFetch.test
URL: http://svn.apache.org/viewvc/james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/HeaderPartialFetch.test?rev=644913&r1=644912&r2=644913&view=diff
==============================================================================
--- james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/HeaderPartialFetch.test
(original)
+++ james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/HeaderPartialFetch.test
Fri Apr  4 13:58:28 2008
@@ -129,7 +129,7 @@
 S: \* OK \[PERMANENTFLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\Seen\)\]
 S: A5 OK \[READ-WRITE\] SELECT completed\.
 C: A6 FETCH 1 (BODY[HEADER]<0.0>)
-S: A6 BAD Zero value not permitted(.)*
+S: A6 BAD FETCH failed. Illegal arguments.
 C: A7 FETCH 1 (BODY[HEADER]<0.16>)
 S: \* 1 FETCH \(FLAGS \(\\Recent \\Seen\) BODY\[HEADER\]<0> \{16\}
 S: From: Timothy Ta\)
@@ -171,7 +171,7 @@
 S: \)
 S: A12 OK FETCH completed\.
 C: A13 FETCH 1 (BODY[HEADER]<7.0>)
-S: A13 BAD Zero value not permitted(.)*
+S: A13 BAD FETCH failed. Illegal arguments.
 C: A14 FETCH 1 (BODY[HEADER]<7.16>)
 S: \* 1 FETCH \(BODY\[HEADER\]<7> \{16\}
 S: imothy Tayler <t\)
@@ -213,7 +213,7 @@
 S: \)
 S: A19 OK FETCH completed\.
 C: A20 FETCH 1 (BODY[HEADER]<10000.0>)
-S: A20 BAD Zero value not permitted(.)*
+S: A20 BAD FETCH failed. Illegal arguments.
 C: A21 FETCH 1 (BODY[HEADER]<10000.16>)
 S: \* 1 FETCH \(BODY\[HEADER\]<10000> \{0\}
 S: \)

Modified: james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/Login.test
URL: http://svn.apache.org/viewvc/james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/Login.test?rev=644913&r1=644912&r2=644913&view=diff
==============================================================================
--- james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/Login.test
(original)
+++ james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/Login.test
Fri Apr  4 13:58:28 2008
@@ -18,13 +18,13 @@
 ################################################################
 # Empty file to use for simple login test.
 C: a001 LOGIN
-S: a001 BAD Missing argument. Command should be '<tag> LOGIN <userid> <password>'
+S: a001 BAD LOGIN failed. Illegal arguments.
 
 C: a002 LOGIN invaliduser
-S: a002 BAD Missing argument. Command should be '<tag> LOGIN <userid> <password>'
+S: a002 BAD LOGIN failed. Illegal arguments.
 
 C: a002a LOGIN imapuser password extra
-S: a002a BAD Expected end-of-line, found 'e'. Command should be '<tag> LOGIN <userid>
<password>'
+S: a002a BAD LOGIN failed. Illegal arguments.
 
 C: a003 LOGIN invaliduser password
 S: a003 NO LOGIN failed. Invalid login/password.

Modified: james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/Logout.test
URL: http://svn.apache.org/viewvc/james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/Logout.test?rev=644913&r1=644912&r2=644913&view=diff
==============================================================================
--- james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/Logout.test
(original)
+++ james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/Logout.test
Fri Apr  4 13:58:28 2008
@@ -17,7 +17,7 @@
 # under the License.                                           #
 ################################################################
 C: a023 LOGOUT extra stuff
-S: a023 BAD Expected end-of-line, found 'e'. Command should be '<tag> LOGOUT'
+S: a023 BAD LOGOUT failed. Illegal arguments.
 
 C: A023 LOGOUT
 S: \* BYE IMAP4rev1 Server logging out

Modified: james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/MimePartialFetch.test
URL: http://svn.apache.org/viewvc/james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/MimePartialFetch.test?rev=644913&r1=644912&r2=644913&view=diff
==============================================================================
--- james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/MimePartialFetch.test
(original)
+++ james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/MimePartialFetch.test
Fri Apr  4 13:58:28 2008
@@ -129,7 +129,7 @@
 S: \* OK \[PERMANENTFLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\Seen\)\]
 S: A5 OK \[READ-WRITE\] SELECT completed\.
 C: A6 FETCH 1 (BODY[4.1.MIME]<0.0>)
-S: A6 BAD Zero value not permitted(.)*
+S: A6 BAD FETCH failed. Illegal arguments.
 C: A7 FETCH 1 (BODY[4.1.MIME]<0.15>)
 S: \* 1 FETCH \(FLAGS \(\\Recent \\Seen\) BODY\[4\.1\.MIME\]<0> \{15\}
 S: Content-Type: i\)
@@ -174,7 +174,7 @@
 S: \)
 S: A12 OK FETCH completed\.
 C: A13 FETCH 1 (BODY[4.1.MIME]<17.0>)
-S: A13 BAD Zero value not permitted(.)*
+S: A13 BAD FETCH failed. Illegal arguments.
 C: A14 FETCH 1 (BODY[4.1.MIME]<17.16>)
 S: \* 1 FETCH \(BODY\[4\.1\.MIME\]<17> \{16\}
 S: ge/gif
@@ -221,7 +221,7 @@
 S: \)
 S: A19 OK FETCH completed\.
 C: A20 FETCH 1 (BODY[4.1.MIME]<10000.0>)
-S: A20 BAD Zero value not permitted(.)*
+S: A20 BAD FETCH failed. Illegal arguments.
 C: A21 FETCH 1 (BODY[4.1.MIME]<10000.16>)
 S: \* 1 FETCH \(BODY\[4\.1\.MIME\]<10000> \{0\}
 S: \)

Modified: james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/TextPartialFetch.test
URL: http://svn.apache.org/viewvc/james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/TextPartialFetch.test?rev=644913&r1=644912&r2=644913&view=diff
==============================================================================
--- james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/TextPartialFetch.test
(original)
+++ james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/TextPartialFetch.test
Fri Apr  4 13:58:28 2008
@@ -129,7 +129,7 @@
 S: \* OK \[PERMANENTFLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\Seen\)\]
 S: A5 OK \[READ-WRITE\] SELECT completed\.
 C: A6 FETCH 1 (BODY[TEXT]<0.0>)
-S: A6 BAD Zero value not permitted(.)*
+S: A6 BAD FETCH failed. Illegal arguments.
 C: A7 FETCH 1 (BODY[TEXT]<0.16>)
 S: \* 1 FETCH \(FLAGS \(\\Recent \\Seen\) BODY\[TEXT\]<0> \{16\}
 S: Start with a pre\)
@@ -304,7 +304,7 @@
 S: \)
 S: A12 OK FETCH completed\.
 C: A13 FETCH 1 (BODY[TEXT]<7.0>)
-S: A13 BAD Zero value not permitted(.)*
+S: A13 BAD FETCH failed. Illegal arguments.
 C: A14 FETCH 1 (BODY[TEXT]<7.16>)
 S: \* 1 FETCH \(BODY\[TEXT\]<7> \{16\}
 S: ith a preamble
@@ -482,7 +482,7 @@
 S: \)
 S: A19 OK FETCH completed\.
 C: A20 FETCH 1 (BODY[TEXT]<10000.0>)
-S: A20 BAD Zero value not permitted(.)*
+S: A20 BAD FETCH failed. Illegal arguments.
 C: A21 FETCH 1 (BODY[TEXT]<10000.16>)
 S: \* 1 FETCH \(BODY\[TEXT\]<10000> \{0\}
 S: \)

Modified: james/server/trunk/imap-api/src/main/java/org/apache/james/api/imap/display/HumanReadableTextKey.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-api/src/main/java/org/apache/james/api/imap/display/HumanReadableTextKey.java?rev=644913&r1=644912&r2=644913&view=diff
==============================================================================
--- james/server/trunk/imap-api/src/main/java/org/apache/james/api/imap/display/HumanReadableTextKey.java
(original)
+++ james/server/trunk/imap-api/src/main/java/org/apache/james/api/imap/display/HumanReadableTextKey.java
Fri Apr  4 13:58:28 2008
@@ -58,6 +58,10 @@
     = new HumanReadableTextKey("org.apache.james.imap.INVALID_COMMAND", 
             "failed. Command not valid in this state.");
     
+    public static final HumanReadableTextKey ILLEGAL_ARGUMENTS
+    = new HumanReadableTextKey("org.apache.james.imap.ILLEGAL_ARGUMENTS", 
+            "failed. Illegal arguments.");
+    
     public static final HumanReadableTextKey FAILURE_MAIL_PARSE 
     = new HumanReadableTextKey("org.apache.james.imap.FAILURE_MAIL_PARSE", 
             "failed. Mail cannot be parsed.");
@@ -89,6 +93,10 @@
     public static final HumanReadableTextKey UNSUPPORTED_AUTHENTICATION_MECHANISM 
     = new HumanReadableTextKey("org.apache.james.imap.UNSUPPORTED_AUTHENTICATION_MECHANISM",
             "failed. Authentication mechanism is unsupported.");
+    
+    public static final HumanReadableTextKey UNKNOWN_COMMAND
+    = new HumanReadableTextKey("org.apache.james.imap.UNKNOWN_COMMAND",
+            "failed. Unknown command.");
     
     public static final HumanReadableTextKey BAD_CHARSET 
         = new HumanReadableTextKey("org.apache.james.imap.BAD_CHARSET",

Modified: james/server/trunk/imap-api/src/main/java/org/apache/james/api/imap/imap4rev1/Imap4Rev1MessageFactory.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-api/src/main/java/org/apache/james/api/imap/imap4rev1/Imap4Rev1MessageFactory.java?rev=644913&r1=644912&r2=644913&view=diff
==============================================================================
--- james/server/trunk/imap-api/src/main/java/org/apache/james/api/imap/imap4rev1/Imap4Rev1MessageFactory.java
(original)
+++ james/server/trunk/imap-api/src/main/java/org/apache/james/api/imap/imap4rev1/Imap4Rev1MessageFactory.java
Fri Apr  4 13:58:28 2008
@@ -25,10 +25,12 @@
 
 import org.apache.james.api.imap.ImapCommand;
 import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.display.HumanReadableTextKey;
 import org.apache.james.api.imap.message.FetchData;
 import org.apache.james.api.imap.message.IdRange;
 import org.apache.james.api.imap.message.StatusDataItems;
 import org.apache.james.api.imap.message.request.SearchKey;
+import org.apache.james.api.imap.message.response.imap4rev1.StatusResponse;
 
 /**
  * Creates messages.
@@ -36,7 +38,14 @@
  */
 public interface Imap4Rev1MessageFactory {
 
-    public ImapMessage createErrorMessage(String message, String tag);
+    /**
+     * Creates a tagged BAD status response.
+     * @param tag <code>CharSequence</code>, not null
+     * @param command <code>ImapCommand</code>, not null
+     * @param displayTextKey key to the human readable code to be displayed
+     * @return <code>StatusResponse</code>, not null
+     */
+    public StatusResponse taggedBad(String tag, ImapCommand command, HumanReadableTextKey
displayTextKey);
     
     public ImapMessage createBadRequestMessage(final String message);
     

Modified: james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imap/message/request/base/BaseImap4Rev1MessageFactory.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imap/message/request/base/BaseImap4Rev1MessageFactory.java?rev=644913&r1=644912&r2=644913&view=diff
==============================================================================
--- james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imap/message/request/base/BaseImap4Rev1MessageFactory.java
(original)
+++ james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imap/message/request/base/BaseImap4Rev1MessageFactory.java
Fri Apr  4 13:58:28 2008
@@ -25,11 +25,14 @@
 
 import org.apache.james.api.imap.ImapCommand;
 import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.display.HumanReadableTextKey;
 import org.apache.james.api.imap.imap4rev1.Imap4Rev1MessageFactory;
 import org.apache.james.api.imap.message.FetchData;
 import org.apache.james.api.imap.message.IdRange;
 import org.apache.james.api.imap.message.StatusDataItems;
 import org.apache.james.api.imap.message.request.SearchKey;
+import org.apache.james.api.imap.message.response.imap4rev1.StatusResponse;
+import org.apache.james.api.imap.message.response.imap4rev1.StatusResponseFactory;
 import org.apache.james.imap.message.request.imap4rev1.AppendRequest;
 import org.apache.james.imap.message.request.imap4rev1.AuthenticateRequest;
 import org.apache.james.imap.message.request.imap4rev1.CapabilityRequest;
@@ -54,15 +57,18 @@
 import org.apache.james.imap.message.request.imap4rev1.SubscribeRequest;
 import org.apache.james.imap.message.request.imap4rev1.UnsubscribeRequest;
 import org.apache.james.imap.message.response.imap4rev1.legacy.BadResponse;
-import org.apache.james.imap.message.response.imap4rev1.legacy.ErrorResponse;
 
 /**
  * Naive, factory creates unpooled instances.
  */
 public class BaseImap4Rev1MessageFactory implements Imap4Rev1MessageFactory {
-
-    public ImapMessage createErrorMessage(String message, String tag) {
-        return new ErrorResponse( message, tag );
+    
+    private StatusResponseFactory statusResponseFactory;
+    
+    public BaseImap4Rev1MessageFactory(
+            StatusResponseFactory statusResponseFactory) {
+        super();
+        this.statusResponseFactory = statusResponseFactory;
     }
 
     public ImapMessage createAppendMessage(ImapCommand command, String mailboxName, Flags
flags, Date datetime, MimeMessage message, String tag) {
@@ -160,5 +166,10 @@
 
     public ImapMessage createCheckMessage(ImapCommand command, String tag) {
         return new CheckRequest(command, tag);
+    }
+
+    public StatusResponse taggedBad(String tag, ImapCommand command,
+            HumanReadableTextKey displayTextKey) {
+        return statusResponseFactory.taggedBad(tag, command, displayTextKey);
     }
 }

Modified: james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imapserver/codec/decode/base/AbstractImapCommandParser.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imapserver/codec/decode/base/AbstractImapCommandParser.java?rev=644913&r1=644912&r2=644913&view=diff
==============================================================================
--- james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imapserver/codec/decode/base/AbstractImapCommandParser.java
(original)
+++ james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imapserver/codec/decode/base/AbstractImapCommandParser.java
Fri Apr  4 13:58:28 2008
@@ -38,6 +38,7 @@
 import org.apache.james.api.imap.ImapConstants;
 import org.apache.james.api.imap.ImapMessage;
 import org.apache.james.api.imap.ProtocolException;
+import org.apache.james.api.imap.display.HumanReadableTextKey;
 import org.apache.james.api.imap.imap4rev1.Imap4Rev1MessageFactory;
 import org.apache.james.api.imap.message.IdRange;
 import org.apache.james.api.imap.message.request.DayMonthYear;
@@ -113,10 +114,8 @@
             result = message;
             
         } catch ( ProtocolException e ) {
-            getLogger().debug("error processing command ", e);
-            String msg = e.getMessage() + " Command should be '" +
-                    command.getExpectedMessage() + "'";
-            result = messageFactory.createErrorMessage( msg, tag );
+            getLogger().debug("Cannot parse protocol ", e);
+            result = messageFactory.taggedBad(tag, command, HumanReadableTextKey.ILLEGAL_ARGUMENTS);
         }
         return result;
     }

Modified: james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imapserver/codec/decode/main/DefaultImapDecoder.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imapserver/codec/decode/main/DefaultImapDecoder.java?rev=644913&r1=644912&r2=644913&view=diff
==============================================================================
--- james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imapserver/codec/decode/main/DefaultImapDecoder.java
(original)
+++ james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imapserver/codec/decode/main/DefaultImapDecoder.java
Fri Apr  4 13:58:28 2008
@@ -22,6 +22,7 @@
 import org.apache.avalon.framework.logger.Logger;
 import org.apache.james.api.imap.ImapMessage;
 import org.apache.james.api.imap.ProtocolException;
+import org.apache.james.api.imap.display.HumanReadableTextKey;
 import org.apache.james.api.imap.imap4rev1.Imap4Rev1MessageFactory;
 import org.apache.james.imapserver.codec.decode.ImapCommandParser;
 import org.apache.james.imapserver.codec.decode.ImapCommandParserFactory;
@@ -31,7 +32,6 @@
 
 public class DefaultImapDecoder extends AbstractLogEnabled implements ImapDecoder {
 
-    private static final String INVALID_COMMAND = "Invalid command.";
     private static final String REQUEST_SYNTAX = "Protocol Error: Was expecting <tag SPACE
command [arguments]>";
 
     private final Imap4Rev1MessageFactory messageFactory;
@@ -77,7 +77,7 @@
         }
         catch ( ProtocolException e ) {
             logger.debug("Error during initial request parsing", e);            
-            message = messageFactory.createErrorMessage(REQUEST_SYNTAX , tag);
+            message = messageFactory.taggedBad(tag, null, HumanReadableTextKey.UNKNOWN_COMMAND);
         }
         return message;
     }
@@ -91,7 +91,7 @@
         final ImapCommandParser command = imapCommands.getParser( commandName );
         if ( command == null ) {
             logger.info("Missing command implementation.");
-            message = messageFactory.createErrorMessage(INVALID_COMMAND, tag);
+            message = messageFactory.taggedBad(tag, null, HumanReadableTextKey.UNKNOWN_COMMAND);
         } else {
             message = command.parse( request, tag );
         }

Modified: james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imapserver/codec/encode/main/DefaultImapEncoderFactory.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imapserver/codec/encode/main/DefaultImapEncoderFactory.java?rev=644913&r1=644912&r2=644913&view=diff
==============================================================================
--- james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imapserver/codec/encode/main/DefaultImapEncoderFactory.java
(original)
+++ james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imapserver/codec/encode/main/DefaultImapEncoderFactory.java
Fri Apr  4 13:58:28 2008
@@ -30,7 +30,6 @@
 import org.apache.james.imapserver.codec.encode.imap4rev1.StatusResponseEncoder;
 import org.apache.james.imapserver.codec.encode.imap4rev1.legacy.BadResponseEncoder;
 import org.apache.james.imapserver.codec.encode.imap4rev1.legacy.CapabilityResponseEncoder;
-import org.apache.james.imapserver.codec.encode.imap4rev1.legacy.ErrorResponseEncoder;
 import org.apache.james.imapserver.codec.encode.imap4rev1.server.LSubResponseEncoder;
 import org.apache.james.imapserver.codec.encode.imap4rev1.server.ListResponseEncoder;
 import org.apache.james.imapserver.codec.encode.imap4rev1.server.STATUSResponseEncoder;
@@ -55,8 +54,7 @@
         final LSubResponseEncoder lsubResponseEncoder = new LSubResponseEncoder(searchResponseEncoder);
         final ListResponseEncoder listResponseEncoder = new ListResponseEncoder(lsubResponseEncoder);
         final FlagsResponseEncoder flagsResponseEncoder = new FlagsResponseEncoder(listResponseEncoder);
-        final ErrorResponseEncoder errorResponseEncoder = new ErrorResponseEncoder(flagsResponseEncoder);
-        final CapabilityResponseEncoder capabilityResponseEncoder = new CapabilityResponseEncoder(errorResponseEncoder);
+        final CapabilityResponseEncoder capabilityResponseEncoder = new CapabilityResponseEncoder(flagsResponseEncoder);
         final BadResponseEncoder result = new BadResponseEncoder(capabilityResponseEncoder);
         return result;
     }



---------------------------------------------------------------------
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