james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r643130 - in /james/server/trunk: core-library/src/main/java/org/apache/james/mailboxmanager/ experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/ imap-api/src/main/java/org/apache/james/api/imap...
Date Mon, 31 Mar 2008 20:25:21 GMT
Author: rdonkin
Date: Mon Mar 31 13:25:17 2008
New Revision: 643130

URL: http://svn.apache.org/viewvc?rev=643130&view=rev
Log:
Replaced exceptions with messages

Modified:
    james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/MessageResultUtils.java
    james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/Authenticate.test
    james/server/trunk/imap-api/src/main/java/org/apache/james/api/imap/display/HumanReadableTextKey.java
    james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/base/AbstractImapRequestProcessor.java
    james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/AbstractMailboxSelectionProcessor.java
    james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/AppendProcessor.java
    james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/AuthenticateProcessor.java
    james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CapabilityProcessor.java
    james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CheckProcessor.java
    james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CloseProcessor.java
    james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CopyProcessor.java
    james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CreateProcessor.java
    james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/ExpungeProcessor.java
    james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/FetchProcessor.java
    james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/ListProcessor.java
    james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/NoopProcessor.java
    james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/SearchProcessor.java
    james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/StatusProcessor.java
    james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/StoreProcessor.java
    james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/UnsubscribeProcessor.java

Modified: james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/MessageResultUtils.java
URL: http://svn.apache.org/viewvc/james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/MessageResultUtils.java?rev=643130&r1=643129&r2=643130&view=diff
==============================================================================
--- james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/MessageResultUtils.java (original)
+++ james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/MessageResultUtils.java Mon Mar 31 13:25:17 2008
@@ -39,7 +39,7 @@
      * 
      * @throws MessagingException
      */
-    public static List getAll(final Iterator iterator) throws MessagingException {
+    public static List getAll(final Iterator iterator) {
         List results = IteratorUtils.toList(iterator);
         return results;
     }

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=643130&r1=643129&r2=643130&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 Mon Mar 31 13:25:17 2008
@@ -18,7 +18,7 @@
 ################################################################
 # Unsupported Authentication mechanism
 C: abcd AUTHENTICATE KERBEROS_V4
-S: abcd NO AUTHENTICATE failed. Unsupported authentication mechanism 'KERBEROS_V4'
+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\)'

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=643130&r1=643129&r2=643130&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 Mon Mar 31 13:25:17 2008
@@ -54,6 +54,10 @@
     = new HumanReadableTextKey("org.apache.james.imap.GENERIC_SUBSCRIPTION_FAILURE", 
     "Cannot subscribe."); 
     
+    public static final HumanReadableTextKey FAILURE_MAIL_PARSE 
+    = new HumanReadableTextKey("org.apache.james.imap.FAILURE_MAIL_PARSE", 
+            "failed. Mail cannot be parsed.");
+    
     public static final HumanReadableTextKey FAILURE_NO_SUCH_MAILBOX 
         = new HumanReadableTextKey("org.apache.james.imap.FAILURE_NO_SUCH_MAILBOX", 
                 "failed. No such mailbox.");
@@ -74,6 +78,10 @@
     public static final HumanReadableTextKey UNSUPPORTED_SEARCH_CRITERIA 
         = new HumanReadableTextKey("org.apache.james.imap.UNSUPPORTED_CRITERIA",
                 "failed. One or more search criteria is unsupported.");
+    
+    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 BAD_CHARSET 
         = new HumanReadableTextKey("org.apache.james.imap.BAD_CHARSET",

Modified: james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/base/AbstractImapRequestProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/base/AbstractImapRequestProcessor.java?rev=643130&r1=643129&r2=643130&view=diff
==============================================================================
--- james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/base/AbstractImapRequestProcessor.java (original)
+++ james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/base/AbstractImapRequestProcessor.java Mon Mar 31 13:25:17 2008
@@ -21,11 +21,12 @@
 import java.util.Iterator;
 import java.util.List;
 
+import javax.mail.MessagingException;
+
 import org.apache.avalon.framework.logger.Logger;
 import org.apache.james.api.imap.ImapCommand;
 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.message.request.ImapRequest;
 import org.apache.james.api.imap.message.response.ImapResponseMessage;
@@ -34,10 +35,7 @@
 import org.apache.james.api.imap.process.ImapProcessor;
 import org.apache.james.api.imap.process.ImapSession;
 import org.apache.james.imap.message.response.imap4rev1.legacy.CommandFailedResponse;
-import org.apache.james.imap.message.response.imap4rev1.legacy.ErrorResponse;
-import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.mailboxmanager.MailboxExistsException;
-import org.apache.james.mailboxmanager.MailboxManagerException;
 import org.apache.james.mailboxmanager.MailboxNotFoundException;
 
 abstract public class AbstractImapRequestProcessor extends
@@ -60,39 +58,10 @@
             final ImapSession session) {
         final ImapCommand command = message.getCommand();
         final String tag = message.getTag();
-        try {
-            doProcess(message, command, tag, responder, session);
-        } catch (MailboxException e) {
-            no(command, tag, responder, e);
-        } catch (AuthorizationException e) {
-            no(command, tag, responder, e);
-        } catch (ProtocolException e) {
-            no(command, tag, responder, e);
-        }
+        doProcess(message, command, tag, responder, session);
     }
 
-    protected void no(final ImapCommand command, final String tag, final Responder responder, ProtocolException e) {
-        final Logger logger = getLogger();
-        if (logger != null) {
-            logger.debug("error processing command ", e);
-        }
-        final String msg = e.getMessage() + " Command should be '"
-                + command.getExpectedMessage() + "'";
-        final ImapResponseMessage response = new ErrorResponse(msg, tag);
-        responder.respond(response);
-    }
-
-    protected void no(final ImapCommand command, final String tag, final Responder responder, AuthorizationException e) {
-        final Logger logger = getLogger();
-        if (logger != null) {
-            logger.debug("error processing command ", e);
-        }
-        final String msg = "Authorization error: Lacking permissions to perform requested operation.";
-        final ImapResponseMessage response = new CommandFailedResponse(command, null, msg, tag);
-        responder.respond(response);
-    }
-
-    protected void no(final ImapCommand command, final String tag, final Responder responder, final MailboxManagerException e) {
+    protected void no(final ImapCommand command, final String tag, final Responder responder, final MessagingException e) {
         final Logger logger = getLogger();
         final ImapResponseMessage response;
         if (e instanceof MailboxExistsException) {
@@ -108,19 +77,8 @@
         responder.respond(response);
     }
 
-    protected void no(final ImapCommand command, final String tag, final Responder responder, final MailboxException e) {
-        final Logger logger = getLogger();
-        if (logger != null) {
-            logger.debug("error processing command ", e);
-        }
-        final ImapResponseMessage response = new CommandFailedResponse(command, e.getResponseCode(), e
-                .getMessage(), tag);
-        responder.respond(response);
-    }
-    
     final void doProcess(final ImapRequest message,
-            final ImapCommand command, final String tag, Responder responder, ImapSession session)
-            throws MailboxException, AuthorizationException, ProtocolException {
+            final ImapCommand command, final String tag, Responder responder, ImapSession session) {
         if (!command.validForState(session.getState())) {
             ImapResponseMessage response = new CommandFailedResponse(command,
                     "Command not valid in this state.", tag);
@@ -175,8 +133,7 @@
     }
     
     protected abstract void doProcess(final ImapRequest message,
-            ImapSession session, String tag, ImapCommand command, Responder responder)
-            throws MailboxException, AuthorizationException, ProtocolException;
+            ImapSession session, String tag, ImapCommand command, Responder responder);
     
 
 }

Modified: james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/AbstractMailboxSelectionProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/AbstractMailboxSelectionProcessor.java?rev=643130&r1=643129&r2=643130&view=diff
==============================================================================
--- james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/AbstractMailboxSelectionProcessor.java (original)
+++ james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/AbstractMailboxSelectionProcessor.java Mon Mar 31 13:25:17 2008
@@ -26,7 +26,6 @@
 import javax.mail.Flags;
 
 import org.apache.james.api.imap.ImapCommand;
-import org.apache.james.api.imap.ProtocolException;
 import org.apache.james.api.imap.display.HumanReadableTextKey;
 import org.apache.james.api.imap.message.request.ImapRequest;
 import org.apache.james.api.imap.message.response.imap4rev1.StatusResponse;
@@ -40,10 +39,8 @@
 import org.apache.james.imap.message.response.imap4rev1.FlagsResponse;
 import org.apache.james.imap.message.response.imap4rev1.RecentResponse;
 import org.apache.james.imapserver.processor.base.AbstractMailboxAwareProcessor;
-import org.apache.james.imapserver.processor.base.AuthorizationException;
 import org.apache.james.imapserver.processor.base.ImapSessionUtils;
 import org.apache.james.imapserver.processor.base.SelectedMailboxSessionImpl;
-import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.mailboxmanager.MailboxManagerException;
 import org.apache.james.mailboxmanager.MailboxNotFoundException;
 import org.apache.james.mailboxmanager.MailboxSession;
@@ -77,16 +74,9 @@
     }
     
     protected void doProcess(ImapRequest message,
-            ImapSession session, String tag, ImapCommand command, Responder responder)
-            throws MailboxException, AuthorizationException, ProtocolException {
+            ImapSession session, String tag, ImapCommand command, Responder responder) {
         final AbstractMailboxSelectionRequest request = (AbstractMailboxSelectionRequest) message;
         final String mailboxName = request.getMailboxName();
-        doProcess(mailboxName, session, tag, command, responder);
-    }
-
-    protected final void doProcess(String mailboxName, ImapSession session, String tag,
-            ImapCommand command, Responder responder) throws MailboxException,
-            AuthorizationException, ProtocolException {
         try {
             final String fullMailboxName = buildFullName(session, mailboxName);
             selectMailbox(fullMailboxName, session);
@@ -95,12 +85,12 @@
             responder.respond(statusResponseFactory.taggedNo(tag, command, 
                     HumanReadableTextKey.FAILURE_NO_SUCH_MAILBOX));
         } catch (MailboxManagerException e) {
-            throw new MailboxException(e);
-        }
+            no(command, tag, responder, e);
+        } 
     }
 
     private void respond(String tag, ImapCommand command, ImapSession session,
-            Responder responder) throws MailboxException, MailboxManagerException {
+            Responder responder) throws MailboxManagerException {
         
         ImapMailbox mailbox = ImapSessionUtils.getMailbox(session);
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
@@ -167,7 +157,7 @@
         responder.respond(existsResponse);
     }
 
-    private void selectMailbox(String mailboxName, ImapSession session) throws MailboxException, MailboxManagerException {
+    private void selectMailbox(String mailboxName, ImapSession session) throws MailboxManagerException {
         final MailboxManager mailboxManager = getMailboxManager(session);
         final ImapMailbox mailbox = mailboxManager.getImapMailbox(mailboxName, false);
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);

Modified: james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/AppendProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/AppendProcessor.java?rev=643130&r1=643129&r2=643130&view=diff
==============================================================================
--- james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/AppendProcessor.java (original)
+++ james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/AppendProcessor.java Mon Mar 31 13:25:17 2008
@@ -28,7 +28,6 @@
 import org.apache.avalon.framework.logger.Logger;
 import org.apache.james.api.imap.ImapCommand;
 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.message.request.ImapRequest;
 import org.apache.james.api.imap.message.response.imap4rev1.StatusResponse;
@@ -38,9 +37,7 @@
 import org.apache.james.api.imap.process.SelectedImapMailbox;
 import org.apache.james.imap.message.request.imap4rev1.AppendRequest;
 import org.apache.james.imapserver.processor.base.AbstractMailboxAwareProcessor;
-import org.apache.james.imapserver.processor.base.AuthorizationException;
 import org.apache.james.imapserver.processor.base.ImapSessionUtils;
-import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.mailboxmanager.MailboxManagerException;
 import org.apache.james.mailboxmanager.MailboxSession;
 import org.apache.james.mailboxmanager.MessageResult;
@@ -64,31 +61,19 @@
     }
 
     protected void doProcess(ImapRequest message,
-            ImapSession session, String tag, ImapCommand command, Responder responder)
-            throws MailboxException, AuthorizationException, ProtocolException {
+            ImapSession session, String tag, ImapCommand command, Responder responder){
         final AppendRequest request = (AppendRequest) message;
         final String mailboxName = request.getMailboxName();
         final MimeMessage mimeMessage = request.getMessage();
         final Date datetime = request.getDatetime();
-        doProcess(mailboxName, mimeMessage,
-                datetime, session, tag, command, responder);
-    }
-
-
-
-    private void doProcess(String mailboxName,
-            MimeMessage message, Date datetime, ImapSession session,
-            String tag, ImapCommand command, Responder responder) throws MailboxException,
-            AuthorizationException, ProtocolException {
-        
         // TODO: Flags are ignore: check whether the specification says that
         // they should be processed
         try {
             
-            mailboxName = buildFullName(session, mailboxName);
+            final String fullMailboxName = buildFullName(session, mailboxName);
             final MailboxManager mailboxManager = getMailboxManager(session);
-            final ImapMailbox mailbox = mailboxManager.getImapMailbox(mailboxName, false);
-            appendToMailbox(message, datetime, session, tag, command, mailbox, responder);
+            final ImapMailbox mailbox = mailboxManager.getImapMailbox(fullMailboxName, false);
+            appendToMailbox(mimeMessage, datetime, session, tag, command, mailbox, responder);
             
         } catch (MailboxManagerException mme) {
             // Mailbox API does not provide facilities for diagnosing the problem
@@ -110,7 +95,7 @@
 
     private void appendToMailbox(MimeMessage message, Date datetime, 
             ImapSession session, String tag, ImapCommand command, ImapMailbox mailbox,
-            Responder responder) throws MailboxException {
+            Responder responder) {
         try {
             final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
             final SelectedImapMailbox selectedMailbox = session.getSelected();
@@ -123,15 +108,14 @@
             if (isSelectedMailbox) {
                 selectedMailbox.addRecent(uid);
             }
+            unsolicitedResponses(session, responder, false);
+            okComplete(command, tag, responder);
         } catch (MailboxManagerException e) {
             // TODO why not TRYCREATE?
-            throw new MailboxException(e);
+            no(command, tag, responder, e);
         } catch (MessagingException e) {
-            throw new MailboxException(e);
+            no(command, tag, responder, e);
         }
-        
-        unsolicitedResponses(session, responder, false);
-        okComplete(command, tag, responder);
         
     }
 }

Modified: james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/AuthenticateProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/AuthenticateProcessor.java?rev=643130&r1=643129&r2=643130&view=diff
==============================================================================
--- james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/AuthenticateProcessor.java (original)
+++ james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/AuthenticateProcessor.java Mon Mar 31 13:25:17 2008
@@ -21,17 +21,13 @@
 
 import org.apache.james.api.imap.ImapCommand;
 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.message.request.ImapRequest;
-import org.apache.james.api.imap.message.response.ImapResponseMessage;
 import org.apache.james.api.imap.message.response.imap4rev1.StatusResponseFactory;
 import org.apache.james.api.imap.process.ImapProcessor;
 import org.apache.james.api.imap.process.ImapSession;
 import org.apache.james.imap.message.request.imap4rev1.AuthenticateRequest;
-import org.apache.james.imap.message.response.imap4rev1.legacy.CommandFailedResponse;
 import org.apache.james.imapserver.processor.base.AbstractImapRequestProcessor;
-import org.apache.james.imapserver.processor.base.AuthorizationException;
-import org.apache.james.imapserver.store.MailboxException;
 
 public class AuthenticateProcessor extends AbstractImapRequestProcessor {
 
@@ -44,28 +40,11 @@
     }
 
     protected void doProcess(ImapRequest message,
-            ImapSession session, String tag, ImapCommand command, Responder responder)
-            throws MailboxException, AuthorizationException, ProtocolException {
+            ImapSession session, String tag, ImapCommand command, Responder responder) {
         final AuthenticateRequest request = (AuthenticateRequest) message;
-        final ImapResponseMessage result = doProcess(request, session, tag,
-                command);
-        responder.respond(result);
-    }
-
-    private ImapResponseMessage doProcess(AuthenticateRequest request,
-            ImapSession session, String tag, ImapCommand command)
-            throws MailboxException, AuthorizationException, ProtocolException {
         final String authType = request.getAuthType();
-        final ImapResponseMessage result = doProcess(authType, session, tag,
-                command);
-        return result;
+        getLogger().info("Unsupported authentication mechanism '" + authType + "'");
+        no(command, tag, responder, HumanReadableTextKey.UNSUPPORTED_AUTHENTICATION_MECHANISM);
     }
 
-    private ImapResponseMessage doProcess(String authType, ImapSession session,
-            String tag, ImapCommand command) throws MailboxException,
-            AuthorizationException, ProtocolException {
-        final CommandFailedResponse result = new CommandFailedResponse(command,
-                "Unsupported authentication mechanism '" + authType + "'", tag);
-        return result;
-    }
 }

Modified: james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CapabilityProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CapabilityProcessor.java?rev=643130&r1=643129&r2=643130&view=diff
==============================================================================
--- james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CapabilityProcessor.java (original)
+++ james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CapabilityProcessor.java Mon Mar 31 13:25:17 2008
@@ -21,19 +21,15 @@
 
 import org.apache.james.api.imap.ImapCommand;
 import org.apache.james.api.imap.ImapMessage;
-import org.apache.james.api.imap.ProtocolException;
 import org.apache.james.api.imap.message.request.ImapRequest;
 import org.apache.james.api.imap.message.response.ImapResponseMessage;
 import org.apache.james.api.imap.message.response.imap4rev1.StatusResponseFactory;
 import org.apache.james.api.imap.process.ImapProcessor;
 import org.apache.james.api.imap.process.ImapSession;
-import org.apache.james.api.imap.process.ImapProcessor.Responder;
 import org.apache.james.imap.message.request.imap4rev1.CapabilityRequest;
 import org.apache.james.imap.message.response.imap4rev1.legacy.CapabilityResponse;
 import org.apache.james.imapserver.processor.base.AbstractImapRequestProcessor;
-import org.apache.james.imapserver.processor.base.AuthorizationException;
 import org.apache.james.imapserver.processor.base.ImapSessionUtils;
-import org.apache.james.imapserver.store.MailboxException;
 
 public class CapabilityProcessor extends AbstractImapRequestProcessor {
 
@@ -49,8 +45,7 @@
     }
 
     protected void doProcess(ImapRequest message,
-            ImapSession session, String tag, ImapCommand command, Responder responder)
-            throws MailboxException, AuthorizationException, ProtocolException {
+            ImapSession session, String tag, ImapCommand command, Responder responder) {
         final CapabilityRequest request = (CapabilityRequest) message;
         final ImapResponseMessage result = doProcess(request, session, tag,
                 command);
@@ -58,19 +53,10 @@
     }
 
     private ImapResponseMessage doProcess(CapabilityRequest request,
-            ImapSession session, String tag, ImapCommand command)
-            throws MailboxException, AuthorizationException, ProtocolException {
-        final ImapResponseMessage result = doProcess(session, tag, command);
-        return result;
-    }
-
-    private ImapResponseMessage doProcess(ImapSession session, String tag,
-            ImapCommand command) throws MailboxException,
-            AuthorizationException, ProtocolException {
+            ImapSession session, String tag, ImapCommand command) {
         // TODO: accurately report the capabilities of the server
         final CapabilityResponse result = new CapabilityResponse(command, tag);
         ImapSessionUtils.addUnsolicitedResponses(result, session, false);
-        ;
         return result;
     }
 }

Modified: james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CheckProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CheckProcessor.java?rev=643130&r1=643129&r2=643130&view=diff
==============================================================================
--- james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CheckProcessor.java (original)
+++ james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CheckProcessor.java Mon Mar 31 13:25:17 2008
@@ -21,15 +21,12 @@
 
 import org.apache.james.api.imap.ImapCommand;
 import org.apache.james.api.imap.ImapMessage;
-import org.apache.james.api.imap.ProtocolException;
 import org.apache.james.api.imap.message.request.ImapRequest;
 import org.apache.james.api.imap.message.response.imap4rev1.StatusResponseFactory;
 import org.apache.james.api.imap.process.ImapProcessor;
 import org.apache.james.api.imap.process.ImapSession;
 import org.apache.james.imap.message.request.imap4rev1.CheckRequest;
 import org.apache.james.imapserver.processor.base.AbstractImapRequestProcessor;
-import org.apache.james.imapserver.processor.base.AuthorizationException;
-import org.apache.james.imapserver.store.MailboxException;
 
 public class CheckProcessor extends AbstractImapRequestProcessor {
 
@@ -42,8 +39,7 @@
     }
 
     protected void doProcess(ImapRequest message,
-            ImapSession session, String tag, ImapCommand command, Responder responder)
-            throws MailboxException, AuthorizationException, ProtocolException {
+            ImapSession session, String tag, ImapCommand command, Responder responder) {
         unsolicitedResponses(session, responder, false);
         okComplete(command, tag, responder);
     }

Modified: james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CloseProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CloseProcessor.java?rev=643130&r1=643129&r2=643130&view=diff
==============================================================================
--- james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CloseProcessor.java (original)
+++ james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CloseProcessor.java Mon Mar 31 13:25:17 2008
@@ -21,16 +21,13 @@
 
 import org.apache.james.api.imap.ImapCommand;
 import org.apache.james.api.imap.ImapMessage;
-import org.apache.james.api.imap.ProtocolException;
 import org.apache.james.api.imap.message.request.ImapRequest;
 import org.apache.james.api.imap.message.response.imap4rev1.StatusResponseFactory;
 import org.apache.james.api.imap.process.ImapProcessor;
 import org.apache.james.api.imap.process.ImapSession;
 import org.apache.james.imap.message.request.imap4rev1.CloseRequest;
 import org.apache.james.imapserver.processor.base.AbstractImapRequestProcessor;
-import org.apache.james.imapserver.processor.base.AuthorizationException;
 import org.apache.james.imapserver.processor.base.ImapSessionUtils;
-import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.mailboxmanager.MailboxManagerException;
 import org.apache.james.mailboxmanager.MailboxSession;
 import org.apache.james.mailboxmanager.impl.FetchGroupImpl;
@@ -48,25 +45,24 @@
     }
 
     protected void doProcess(ImapRequest message,
-            ImapSession session, String tag, ImapCommand command, Responder responder)
-            throws MailboxException, AuthorizationException, ProtocolException {
+            ImapSession session, String tag, ImapCommand command, Responder responder) {
         ImapMailbox mailbox = ImapSessionUtils.getMailbox(session);
         if (mailbox.isWriteable()) {
             try {
                 final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
                 mailbox.expunge(GeneralMessageSetImpl.all(),
                         FetchGroupImpl.MINIMAL, mailboxSession);
+                session.deselect();
+                // TODO: the following comment was present in the code before
+                // refactoring
+                // TODO: doesn't seem to match the implementation
+                // TODO: check that implementation is correct
+                // Don't send unsolicited responses on close.
+                unsolicitedResponses(session, responder, false);
+                okComplete(command, tag, responder);
             } catch (MailboxManagerException e) {
-                throw new MailboxException(e);
+                no(command, tag, responder, e);
             }
         }
-        session.deselect();
-        // TODO: the following comment was present in the code before
-        // refactoring
-        // TODO: doesn't seem to match the implementation
-        // TODO: check that implementation is correct
-        // Don't send unsolicited responses on close.
-        unsolicitedResponses(session, responder, false);
-        okComplete(command, tag, responder);
     }
 }

Modified: james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CopyProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CopyProcessor.java?rev=643130&r1=643129&r2=643130&view=diff
==============================================================================
--- james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CopyProcessor.java (original)
+++ james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CopyProcessor.java Mon Mar 31 13:25:17 2008
@@ -21,17 +21,16 @@
 
 import org.apache.james.api.imap.ImapCommand;
 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.message.IdRange;
 import org.apache.james.api.imap.message.request.ImapRequest;
 import org.apache.james.api.imap.message.response.imap4rev1.StatusResponseFactory;
+import org.apache.james.api.imap.message.response.imap4rev1.StatusResponse.ResponseCode;
 import org.apache.james.api.imap.process.ImapProcessor;
 import org.apache.james.api.imap.process.ImapSession;
 import org.apache.james.imap.message.request.imap4rev1.CopyRequest;
 import org.apache.james.imapserver.processor.base.AbstractMailboxAwareProcessor;
-import org.apache.james.imapserver.processor.base.AuthorizationException;
 import org.apache.james.imapserver.processor.base.ImapSessionUtils;
-import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.mailboxmanager.GeneralMessageSet;
 import org.apache.james.mailboxmanager.MailboxManagerException;
 import org.apache.james.mailboxmanager.MailboxSession;
@@ -52,8 +51,7 @@
     }
 
     protected void doProcess(ImapRequest message,
-            ImapSession session, String tag, ImapCommand command, Responder responder)
-            throws MailboxException, AuthorizationException, ProtocolException {
+            ImapSession session, String tag, ImapCommand command, Responder responder) {
         final CopyRequest request = (CopyRequest) message;
         final String mailboxName = request.getMailboxName();
         final IdRange[] idSet = request.getIdSet();
@@ -63,31 +61,31 @@
         try {
             String fullMailboxName = buildFullName(session, mailboxName);
             final MailboxManager mailboxManager = getMailboxManager(session);
-            if (!mailboxManager.existsMailbox(fullMailboxName)) {
-                MailboxException e = new MailboxException(
-                        "Mailbox does not exists");
-                e.setResponseCode("TRYCREATE");
-                throw e;
-            }
-            for (int i = 0; i < idSet.length; i++) {
-                final long highVal;
-                final long lowVal;
-                if (useUids) {
-                    highVal = idSet[i].getHighVal();
-                    lowVal = idSet[i].getLowVal();
-                } else {
-                    highVal = session.getSelected().uid((int)idSet[i].getHighVal());
-                    lowVal = session.getSelected().uid((int)idSet[i].getLowVal());
+            final boolean mailboxExists = mailboxManager.existsMailbox(fullMailboxName);
+            if (!mailboxExists) {
+                no(command, tag, responder, 
+                        HumanReadableTextKey.FAILURE_NO_SUCH_MAILBOX, ResponseCode.tryCreate());
+            } else {
+                for (int i = 0; i < idSet.length; i++) {
+                    final long highVal;
+                    final long lowVal;
+                    if (useUids) {
+                        highVal = idSet[i].getHighVal();
+                        lowVal = idSet[i].getLowVal();
+                    } else {
+                        highVal = session.getSelected().uid((int)idSet[i].getHighVal());
+                        lowVal = session.getSelected().uid((int)idSet[i].getLowVal());
+                    }
+                    GeneralMessageSet messageSet = GeneralMessageSetImpl.uidRange(lowVal, highVal);
+                    final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
+                    mailboxManager.copyMessages(messageSet, currentMailbox.getName(), 
+                            fullMailboxName, mailboxSession);
                 }
-                GeneralMessageSet messageSet = GeneralMessageSetImpl.uidRange(lowVal, highVal);
-                final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
-                mailboxManager.copyMessages(messageSet, currentMailbox.getName(), 
-                        fullMailboxName, mailboxSession);
+                unsolicitedResponses(session, responder, useUids);
+                okComplete(command, tag, responder);
             }
         } catch (MailboxManagerException e) {
-            throw new MailboxException(e);
+            no(command, tag, responder, e);
         }
-        unsolicitedResponses(session, responder, useUids);
-        okComplete(command, tag, responder);
     }
 }

Modified: james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CreateProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CreateProcessor.java?rev=643130&r1=643129&r2=643130&view=diff
==============================================================================
--- james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CreateProcessor.java (original)
+++ james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CreateProcessor.java Mon Mar 31 13:25:17 2008
@@ -21,15 +21,12 @@
 
 import org.apache.james.api.imap.ImapCommand;
 import org.apache.james.api.imap.ImapMessage;
-import org.apache.james.api.imap.ProtocolException;
 import org.apache.james.api.imap.message.request.ImapRequest;
 import org.apache.james.api.imap.message.response.imap4rev1.StatusResponseFactory;
 import org.apache.james.api.imap.process.ImapProcessor;
 import org.apache.james.api.imap.process.ImapSession;
 import org.apache.james.imap.message.request.imap4rev1.CreateRequest;
 import org.apache.james.imapserver.processor.base.AbstractMailboxAwareProcessor;
-import org.apache.james.imapserver.processor.base.AuthorizationException;
-import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.mailboxmanager.MailboxManagerException;
 import org.apache.james.mailboxmanager.manager.MailboxManager;
 import org.apache.james.mailboxmanager.manager.MailboxManagerProvider;
@@ -46,8 +43,7 @@
     }
 
     protected void doProcess(ImapRequest message,
-            ImapSession session, String tag, ImapCommand command, Responder responder)
-            throws MailboxException, AuthorizationException, ProtocolException {
+            ImapSession session, String tag, ImapCommand command, Responder responder) {
         final CreateRequest request = (CreateRequest) message;
         final String mailboxName = request.getMailboxName();
         try {
@@ -55,10 +51,10 @@
             final String fullMailboxName = buildFullName(session, mailboxName);
             final MailboxManager mailboxManager = getMailboxManager(session);
             mailboxManager.createMailbox(fullMailboxName);
+            okComplete(command, tag, responder);
+            unsolicitedResponses(session, responder, false);
         } catch (MailboxManagerException e) {
-            throw new MailboxException(e);
+            no(command, tag, responder, e);
         }
-        okComplete(command, tag, responder);
-        unsolicitedResponses(session, responder, false);
     }
 }

Modified: james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/ExpungeProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/ExpungeProcessor.java?rev=643130&r1=643129&r2=643130&view=diff
==============================================================================
--- james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/ExpungeProcessor.java (original)
+++ james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/ExpungeProcessor.java Mon Mar 31 13:25:17 2008
@@ -23,7 +23,6 @@
 
 import org.apache.james.api.imap.ImapCommand;
 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.message.request.ImapRequest;
 import org.apache.james.api.imap.message.response.imap4rev1.StatusResponseFactory;
@@ -32,9 +31,7 @@
 import org.apache.james.api.imap.process.SelectedImapMailbox;
 import org.apache.james.imap.message.request.imap4rev1.ExpungeRequest;
 import org.apache.james.imapserver.processor.base.AbstractImapRequestProcessor;
-import org.apache.james.imapserver.processor.base.AuthorizationException;
 import org.apache.james.imapserver.processor.base.ImapSessionUtils;
-import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.mailboxmanager.MailboxManagerException;
 import org.apache.james.mailboxmanager.MessageResult;
 import org.apache.james.mailboxmanager.impl.FetchGroupImpl;
@@ -54,8 +51,7 @@
     }
 
     protected void doProcess(ImapRequest message,
-            ImapSession session, String tag, ImapCommand command, Responder responder)
-            throws MailboxException, AuthorizationException, ProtocolException {
+            ImapSession session, String tag, ImapCommand command, Responder responder) {
         ImapMailbox mailbox = ImapSessionUtils.getMailbox(session);
         if (!mailbox.isWriteable()) {
             no(command, tag, responder, HumanReadableTextKey.MAILBOX_IS_READ_ONLY);
@@ -74,7 +70,7 @@
                 unsolicitedResponses(session, responder, false);
                 okComplete(command, tag, responder);
             } catch (MailboxManagerException e) {
-                throw new MailboxException(e);
+                no(command, tag, responder, e);
             }
         }
     }

Modified: james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/FetchProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/FetchProcessor.java?rev=643130&r1=643129&r2=643130&view=diff
==============================================================================
--- james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/FetchProcessor.java (original)
+++ james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/FetchProcessor.java Mon Mar 31 13:25:17 2008
@@ -36,7 +36,6 @@
 import org.apache.james.api.imap.ImapCommand;
 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.message.BodyFetchElement;
 import org.apache.james.api.imap.message.FetchData;
@@ -50,9 +49,7 @@
 import org.apache.james.imap.message.response.imap4rev1.FetchResponse;
 import org.apache.james.imap.message.response.imap4rev1.FetchResponse.BodyElement;
 import org.apache.james.imapserver.processor.base.AbstractImapRequestProcessor;
-import org.apache.james.imapserver.processor.base.AuthorizationException;
 import org.apache.james.imapserver.processor.base.ImapSessionUtils;
-import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.imapserver.store.SimpleMessageAttributes;
 import org.apache.james.mailboxmanager.GeneralMessageSet;
 import org.apache.james.mailboxmanager.MailboxManagerException;
@@ -88,19 +85,11 @@
     }
 
     protected void doProcess(ImapRequest message, ImapSession session,
-            String tag, ImapCommand command, Responder responder)
-            throws MailboxException, AuthorizationException, ProtocolException {
+            String tag, ImapCommand command, Responder responder) {
         final FetchRequest request = (FetchRequest) message;
         final boolean useUids = request.isUseUids();
         final IdRange[] idSet = request.getIdSet();
         final FetchData fetch = request.getFetch();
-        doProcess(useUids, idSet, fetch, session, tag, command, responder);
-    }
-
-    private void doProcess(final boolean useUids,
-            final IdRange[] idSet, final FetchData fetch, ImapSession session,
-            String tag, ImapCommand command, Responder responder) throws MailboxException,
-            AuthorizationException, ProtocolException {
         try
         {
             FetchGroup resultToFetch = getFetchGroup(fetch);
@@ -129,12 +118,14 @@
             okComplete(command, tag, responder);
         } catch (UnsupportedCriteriaException e) {
             no(command, tag, responder, HumanReadableTextKey.UNSUPPORTED_SEARCH_CRITERIA);
-        } catch (MailboxManagerException e) {
-            throw new MailboxException(e);
+        } catch (MessagingException e) {
+            no(command, tag, responder, e);
+        } catch (ParseException e) {
+            no(command, tag, responder, HumanReadableTextKey.FAILURE_MAIL_PARSE);
         }
     }
 
-    private FetchGroup getFetchGroup(FetchData fetch) throws ProtocolException {
+    private FetchGroup getFetchGroup(FetchData fetch) {
         FetchGroupImpl result = new FetchGroupImpl();
         if (fetch.isFlags() || fetch.isSetSeen()) {
             result.or(FetchGroup.FLAGS);
@@ -236,96 +227,86 @@
         }
 
         public FetchResponse build(FetchData fetch, MessageResult result,
-                ImapSession session, boolean useUids)
-                throws MailboxException, ProtocolException {
+                ImapSession session, boolean useUids) throws MessagingException, ParseException {
             ImapMailbox mailbox = ImapSessionUtils.getMailbox(session);
             final SelectedImapMailbox selected = session.getSelected();
             final long resultUid = result.getUid();
             final int resultMsn = selected.msn(resultUid);
             setMsn(resultMsn);
-            
+
             // Check if this fetch will cause the "SEEN" flag to be set on this
             // message
             // If so, update the flags, and ensure that a flags response is included
             // in the response.
-            try {
-                final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
-                boolean ensureFlagsResponse = false;
-                final Flags resultFlags = result.getFlags();
-                if (fetch.isSetSeen()
-                        && !resultFlags.contains(Flags.Flag.SEEN)) {
-                    mailbox.setFlags(new Flags(Flags.Flag.SEEN), true, false,
-                            GeneralMessageSetImpl.oneUid(resultUid), FetchGroupImpl.MINIMAL, mailboxSession);
-                    resultFlags.add(Flags.Flag.SEEN);
-                    ensureFlagsResponse = true;
-                }
-                
-                // FLAGS response
-                if (fetch.isFlags() || ensureFlagsResponse) {
-                    if (selected.isRecent(resultUid)) {
-                        resultFlags.add(Flags.Flag.RECENT);
-                    }
-                    setFlags(resultFlags);
-                }
+            final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
+            boolean ensureFlagsResponse = false;
+            final Flags resultFlags = result.getFlags();
+            if (fetch.isSetSeen()
+                    && !resultFlags.contains(Flags.Flag.SEEN)) {
+                mailbox.setFlags(new Flags(Flags.Flag.SEEN), true, false,
+                        GeneralMessageSetImpl.oneUid(resultUid), FetchGroupImpl.MINIMAL, mailboxSession);
+                resultFlags.add(Flags.Flag.SEEN);
+                ensureFlagsResponse = true;
+            }
 
-                // INTERNALDATE response
-                if (fetch.isInternalDate()) {
-                    setInternalDate(result
-                            .getInternalDate());
+            // FLAGS response
+            if (fetch.isFlags() || ensureFlagsResponse) {
+                if (selected.isRecent(resultUid)) {
+                    resultFlags.add(Flags.Flag.RECENT);
                 }
+                setFlags(resultFlags);
+            }
 
-                // RFC822.SIZE response
-                if (fetch.isSize()) {
-                    setSize(result.getSize());
-                }
+            // INTERNALDATE response
+            if (fetch.isInternalDate()) {
+                setInternalDate(result
+                        .getInternalDate());
+            }
 
-                if (fetch.isEnvelope()) {
-                    this.envelope = buildEnvelope(result);
-                }
-                
-                // Only create when needed
-                if (fetch.isBody() || fetch.isBodyStructure()) {
-                    misc = new StringBuffer();
-                    // TODO: replace SimpleMessageAttributes
-                    final SimpleMessageAttributes attrs = new SimpleMessageAttributes(
-                            result.getMimeMessage(), logger);
-
-                    // BODY response
-                    if (fetch.isBody()) {
-                        misc.append(" BODY ");
-                        misc.append(attrs.getBodyStructure(false));
-                    }
+            // RFC822.SIZE response
+            if (fetch.isSize()) {
+                setSize(result.getSize());
+            }
 
-                    // BODYSTRUCTURE response
-                    if (fetch.isBodyStructure()) {
-                        misc.append(" BODYSTRUCTURE ");
-                        misc.append(attrs.getBodyStructure(true));
-                    }
+            if (fetch.isEnvelope()) {
+                this.envelope = buildEnvelope(result);
+            }
+
+            // Only create when needed
+            if (fetch.isBody() || fetch.isBodyStructure()) {
+                misc = new StringBuffer();
+                // TODO: replace SimpleMessageAttributes
+                final SimpleMessageAttributes attrs = new SimpleMessageAttributes(
+                        result.getMimeMessage(), logger);
+
+                // BODY response
+                if (fetch.isBody()) {
+                    misc.append(" BODY ");
+                    misc.append(attrs.getBodyStructure(false));
                 }
-                // UID response
-                if (fetch.isUid()) {
-                    setUid(resultUid);
+
+                // BODYSTRUCTURE response
+                if (fetch.isBodyStructure()) {
+                    misc.append(" BODYSTRUCTURE ");
+                    misc.append(attrs.getBodyStructure(true));
                 }
+            }
+            // UID response
+            if (fetch.isUid()) {
+                setUid(resultUid);
+            }
 
-                // BODY part responses.
-                Collection elements = fetch.getBodyElements();
-                this.elements = new ArrayList();
-                for (Iterator iterator = elements.iterator(); iterator.hasNext();) {
-                    BodyFetchElement fetchElement = (BodyFetchElement) iterator.next();
-                    final FetchResponse.BodyElement element = bodyFetch(result, fetchElement);
-                    if (element != null) {
-                        this.elements.add(element);
-                    }
+            // BODY part responses.
+            Collection elements = fetch.getBodyElements();
+            this.elements = new ArrayList();
+            for (Iterator iterator = elements.iterator(); iterator.hasNext();) {
+                BodyFetchElement fetchElement = (BodyFetchElement) iterator.next();
+                final FetchResponse.BodyElement element = bodyFetch(result, fetchElement);
+                if (element != null) {
+                    this.elements.add(element);
                 }
-                return build();
-            } catch (MailboxManagerException mme) {
-                throw new MailboxException(mme);
-            } catch (MessagingException me) {
-                throw new MailboxException(me);
-            } catch (ParseException e) {
-                logger.debug("Cannot parse header address", e);
-                throw new MailboxException("Cannot parse address");
             }
+            return build();
         }
 
         private FetchResponse.Envelope buildEnvelope(final MessageResult messageResult) throws MessagingException, ParseException {
@@ -483,7 +464,7 @@
         }
 
         private FetchResponse.BodyElement bodyFetch(final MessageResult messageResult,
-                BodyFetchElement fetchElement) throws MessagingException, ProtocolException {
+                BodyFetchElement fetchElement) throws MessagingException {
             
             final Long firstOctet = fetchElement.getFirstOctet();
             final Long numberOfOctets = fetchElement.getNumberOfOctets();
@@ -500,7 +481,8 @@
 
         }
 
-        private FetchResponse.BodyElement bodyContent(final MessageResult messageResult, final String name, final int specifier, final int[] path, final Collection names, final boolean isBase) throws MailboxManagerException, MessagingException {
+        private FetchResponse.BodyElement bodyContent(final MessageResult messageResult, final String name, 
+                final int specifier, final int[] path, final Collection names, final boolean isBase) throws MessagingException {
             final FetchResponse.BodyElement fullResult;
             switch (specifier) {
                 case BodyFetchElement.CONTENT:
@@ -533,7 +515,8 @@
             return fullResult;
         }
 
-        private FetchResponse.BodyElement wrapIfPartialFetch(final Long firstOctet, final Long numberOfOctets, final FetchResponse.BodyElement fullResult) {
+        private FetchResponse.BodyElement wrapIfPartialFetch(final Long firstOctet, final Long numberOfOctets, 
+                final FetchResponse.BodyElement fullResult) {
             final FetchResponse.BodyElement result;
             if (firstOctet == null) {
                 result = fullResult;
@@ -564,7 +547,8 @@
             return result;
         }
 
-        private FetchResponse.BodyElement mimeHeaders(final MessageResult messageResult, String name, final int[] path, final boolean isBase) throws MailboxManagerException, MessagingException {
+        private FetchResponse.BodyElement mimeHeaders(final MessageResult messageResult, 
+                String name, final int[] path, final boolean isBase) throws MessagingException {
             final FetchResponse.BodyElement result;
             final Iterator headers = getMimeHeaders(messageResult, path, isBase);
             List lines = MessageResultUtils.getAll(headers);
@@ -611,13 +595,15 @@
             return headers;
         }
         
-        private Iterator getMimeHeaders(final MessageResult messageResult, final int[] path, final boolean isBase) throws MailboxManagerException {
+        private Iterator getMimeHeaders(final MessageResult messageResult, final int[] path, 
+                final boolean isBase) throws MessagingException {
             MessageResult.MimePath mimePath = new MimePathImpl(path);
             final Iterator headers = messageResult.iterateMimeHeaders(mimePath);
             return headers;
         }
 
-        private FetchResponse.BodyElement content(final MessageResult messageResult, String name, final int[] path, final boolean isBase) throws MailboxManagerException {
+        private FetchResponse.BodyElement content(final MessageResult messageResult, String name, 
+                final int[] path, final boolean isBase) throws MessagingException {
             final FetchResponse.BodyElement result;
             final MessageResult.Content full;
             if (isBase) {

Modified: james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/ListProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/ListProcessor.java?rev=643130&r1=643129&r2=643130&view=diff
==============================================================================
--- james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/ListProcessor.java (original)
+++ james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/ListProcessor.java Mon Mar 31 13:25:17 2008
@@ -19,11 +19,9 @@
 
 package org.apache.james.imapserver.processor.imap4rev1;
 
-import org.apache.avalon.framework.logger.Logger;
 import org.apache.james.api.imap.ImapCommand;
 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.message.request.ImapRequest;
 import org.apache.james.api.imap.message.response.ImapResponseMessage;
 import org.apache.james.api.imap.message.response.imap4rev1.StatusResponseFactory;
@@ -32,9 +30,7 @@
 import org.apache.james.imap.message.request.imap4rev1.ListRequest;
 import org.apache.james.imap.message.response.imap4rev1.server.ListResponse;
 import org.apache.james.imapserver.processor.base.AbstractMailboxAwareProcessor;
-import org.apache.james.imapserver.processor.base.AuthorizationException;
 import org.apache.james.imapserver.processor.base.ImapSessionUtils;
-import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.mailboxmanager.ListResult;
 import org.apache.james.mailboxmanager.MailboxManagerException;
 import org.apache.james.mailboxmanager.impl.ListResultImpl;
@@ -55,8 +51,7 @@
     }
 
     protected void doProcess(ImapRequest message,
-            ImapSession session, String tag, ImapCommand command, Responder responder)
-            throws MailboxException, AuthorizationException, ProtocolException {
+            ImapSession session, String tag, ImapCommand command, Responder responder) {
         final ListRequest request = (ListRequest) message;
         final String baseReferenceName = request.getBaseReferenceName();
         final String mailboxPatternString = request.getMailboxPattern();
@@ -75,74 +70,76 @@
             final String mailboxPattern,
             final ImapSession session, 
             final String tag, ImapCommand command,
-            final Responder responder)
-            throws MailboxException, AuthorizationException, ProtocolException {
-
-        String referenceName = baseReferenceName;
-        // Should the #user.userName section be removed from names returned?
-        final boolean removeUserPrefix;
-
-        final ListResult[] listResults;
-
-        final User user = ImapSessionUtils.getUser(session);
-        final String personalNamespace = ImapConstants.USER_NAMESPACE
-                + ImapConstants.HIERARCHY_DELIMITER_CHAR + user.getUserName();
-
-        if (mailboxPattern.length() == 0) {
-            // An empty mailboxPattern signifies a request for the hierarchy
-            // delimiter
-            // and root name of the referenceName argument
-
-            String referenceRoot;
-            if (referenceName.startsWith(ImapConstants.NAMESPACE_PREFIX)) {
-                // A qualified reference name - get the first element,
-                // and don't remove the user prefix
-                removeUserPrefix = false;
-                int firstDelimiter = referenceName
-                        .indexOf(ImapConstants.HIERARCHY_DELIMITER_CHAR);
-                if (firstDelimiter == -1) {
-                    referenceRoot = referenceName;
+            final Responder responder) {
+        try {
+            String referenceName = baseReferenceName;
+            // Should the #user.userName section be removed from names returned?
+            final boolean removeUserPrefix;
+
+            final ListResult[] listResults;
+
+            final User user = ImapSessionUtils.getUser(session);
+            final String personalNamespace = ImapConstants.USER_NAMESPACE
+            + ImapConstants.HIERARCHY_DELIMITER_CHAR + user.getUserName();
+
+            if (mailboxPattern.length() == 0) {
+                // An empty mailboxPattern signifies a request for the hierarchy
+                // delimiter
+                // and root name of the referenceName argument
+
+                String referenceRoot;
+                if (referenceName.startsWith(ImapConstants.NAMESPACE_PREFIX)) {
+                    // A qualified reference name - get the first element,
+                    // and don't remove the user prefix
+                    removeUserPrefix = false;
+                    int firstDelimiter = referenceName
+                    .indexOf(ImapConstants.HIERARCHY_DELIMITER_CHAR);
+                    if (firstDelimiter == -1) {
+                        referenceRoot = referenceName;
+                    } else {
+                        referenceRoot = referenceName.substring(0, firstDelimiter);
+                    }
                 } else {
-                    referenceRoot = referenceName.substring(0, firstDelimiter);
+                    // A relative reference name - need to remove user prefix from
+                    // results.
+                    referenceRoot = "";
+                    removeUserPrefix = true;
+
                 }
-            } else {
-                // A relative reference name - need to remove user prefix from
-                // results.
-                referenceRoot = "";
-                removeUserPrefix = true;
 
-            }
+                // Get the mailbox for the reference name.
+                listResults = new ListResult[1];
+                listResults[0] = ListResultImpl.createNoSelect(referenceRoot, ImapConstants.HIERARCHY_DELIMITER);
+            } else {
 
-            // Get the mailbox for the reference name.
-            listResults = new ListResult[1];
-            listResults[0] = ListResultImpl.createNoSelect(referenceRoot, ImapConstants.HIERARCHY_DELIMITER);
-        } else {
+                // If the mailboxPattern is fully qualified, ignore the
+                // reference name.
+                if (mailboxPattern.charAt(0) == ImapConstants.NAMESPACE_PREFIX_CHAR) {
+                    referenceName = "";
+                }
 
-            // If the mailboxPattern is fully qualified, ignore the
-            // reference name.
-            if (mailboxPattern.charAt(0) == ImapConstants.NAMESPACE_PREFIX_CHAR) {
-                referenceName = "";
-            }
+                // If the search pattern is relative, need to remove user prefix
+                // from results.
+                removeUserPrefix = ((referenceName + mailboxPattern).charAt(0) != ImapConstants.NAMESPACE_PREFIX_CHAR);
 
-            // If the search pattern is relative, need to remove user prefix
-            // from results.
-            removeUserPrefix = ((referenceName + mailboxPattern).charAt(0) != ImapConstants.NAMESPACE_PREFIX_CHAR);
+                if (removeUserPrefix) {
+                    referenceName = personalNamespace + "." + referenceName;
+                }
 
-            if (removeUserPrefix) {
-                referenceName = personalNamespace + "." + referenceName;
+                listResults = doList(session, referenceName, mailboxPattern);
             }
 
-            listResults = doList(session, referenceName, mailboxPattern);
-        }
+            int prefixLength = personalNamespace.length();
 
-        int prefixLength = personalNamespace.length();
+            for (int i = 0; i < listResults.length; i++) {
+                final ListResult listResult = listResults[i];
+                processResult(responder, removeUserPrefix, prefixLength, listResult);
+            }   
 
-        for (int i = 0; i < listResults.length; i++) {
-            final ListResult listResult = listResults[i];
-            processResult(responder, removeUserPrefix, prefixLength, listResult);
-        }   
-        
-        okComplete(command, tag, responder);
+            okComplete(command, tag, responder);
+        } catch (MailboxManagerException e) {
+            no(command,tag, responder, e);
+        }
     }
 
     void processResult(final Responder responder, final boolean removeUserPrefix, 
@@ -169,20 +166,6 @@
                 delimiter, mailboxName));
     }
 
-    private void logMarkedUnmarkedNoSelectMailbox(final String mailboxName) {
-        final Logger logger = getLogger();
-        if (logger != null && logger.isDebugEnabled()) {
-            logger.debug("Marked or unmarked flags set on NoSelect mailbox: " + mailboxName);
-        }
-    }
-    
-    private void logMarkedUnmarkedMailbox(final String mailboxName) {
-        final Logger logger = getLogger();
-        if (logger != null && logger.isDebugEnabled()) {
-            logger.debug("Marked and unmarked flags set on mailbox: " + mailboxName);
-        }
-    }
-
     private String mailboxName(final boolean removeUserPrefix, int prefixLength, final ListResult listResult) {
         final String mailboxName;
         final String name = listResult.getName();
@@ -199,13 +182,9 @@
     }
    
     protected final ListResult[] doList(ImapSession session, String base,
-            String pattern) throws MailboxException {
-        try {
-            final MailboxManager mailboxManager = getMailboxManager(session);
-            final ListResult[] result = mailboxManager.list(new MailboxExpression(base,pattern, '*', '%'));
-            return result;
-        } catch (MailboxManagerException e) {
-            throw new MailboxException(e);
-        }
+            String pattern) throws MailboxManagerException  {
+        final MailboxManager mailboxManager = getMailboxManager(session);
+        final ListResult[] result = mailboxManager.list(new MailboxExpression(base,pattern, '*', '%'));
+        return result;
     }
 }

Modified: james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/NoopProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/NoopProcessor.java?rev=643130&r1=643129&r2=643130&view=diff
==============================================================================
--- james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/NoopProcessor.java (original)
+++ james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/NoopProcessor.java Mon Mar 31 13:25:17 2008
@@ -21,15 +21,12 @@
 
 import org.apache.james.api.imap.ImapCommand;
 import org.apache.james.api.imap.ImapMessage;
-import org.apache.james.api.imap.ProtocolException;
 import org.apache.james.api.imap.message.request.ImapRequest;
 import org.apache.james.api.imap.message.response.imap4rev1.StatusResponseFactory;
 import org.apache.james.api.imap.process.ImapProcessor;
 import org.apache.james.api.imap.process.ImapSession;
 import org.apache.james.imap.message.request.imap4rev1.NoopRequest;
 import org.apache.james.imapserver.processor.base.AbstractImapRequestProcessor;
-import org.apache.james.imapserver.processor.base.AuthorizationException;
-import org.apache.james.imapserver.store.MailboxException;
 
 public class NoopProcessor extends AbstractImapRequestProcessor {
 
@@ -42,8 +39,7 @@
     }
 
     protected void doProcess(ImapRequest message,
-            ImapSession session, String tag, ImapCommand command, Responder responder)
-            throws MailboxException, AuthorizationException, ProtocolException {
+            ImapSession session, String tag, ImapCommand command, Responder responder) {
         final NoopRequest request = (NoopRequest) message;
         // TODO: untagged responses?
         // TODO: NOOP is used to check for new mail: need to return untagged

Modified: james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/SearchProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/SearchProcessor.java?rev=643130&r1=643129&r2=643130&view=diff
==============================================================================
--- james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/SearchProcessor.java (original)
+++ james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/SearchProcessor.java Mon Mar 31 13:25:17 2008
@@ -29,7 +29,6 @@
 
 import org.apache.james.api.imap.ImapCommand;
 import org.apache.james.api.imap.ImapMessage;
-import org.apache.james.api.imap.ProtocolException;
 import org.apache.james.api.imap.message.IdRange;
 import org.apache.james.api.imap.message.request.DayMonthYear;
 import org.apache.james.api.imap.message.request.ImapRequest;
@@ -41,9 +40,7 @@
 import org.apache.james.imap.message.request.imap4rev1.SearchRequest;
 import org.apache.james.imap.message.response.imap4rev1.server.SearchResponse;
 import org.apache.james.imapserver.processor.base.AbstractImapRequestProcessor;
-import org.apache.james.imapserver.processor.base.AuthorizationException;
 import org.apache.james.imapserver.processor.base.ImapSessionUtils;
-import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.mailboxmanager.MailboxManagerException;
 import org.apache.james.mailboxmanager.MessageResult;
 import org.apache.james.mailboxmanager.SearchQuery;
@@ -64,31 +61,27 @@
     }
 
     protected void doProcess(ImapRequest message,
-            ImapSession session, String tag, ImapCommand command, Responder responder)
-            throws MailboxException, AuthorizationException, ProtocolException {
-        final SearchRequest request = (SearchRequest) message;
-        final SearchKey searchKey = request.getSearchKey();
-        final boolean useUids = request.isUseUids();
-        doProcess(searchKey, useUids, session, tag, command, responder);
-    }
-
-    private void doProcess(final SearchKey searchKey,
-            final boolean useUids, final ImapSession session, final String tag,
-            final ImapCommand command, final Responder responder) throws MailboxException,
-            AuthorizationException, ProtocolException {
-        ImapMailbox mailbox = ImapSessionUtils.getMailbox(session);
-        final FetchGroup fetchGroup = FetchGroupImpl.MINIMAL;
-
-        final SearchQuery query = toQuery(searchKey, session);
-        
-        final Collection results = findIds(useUids, session, mailbox, fetchGroup, query);
-        final long[] ids = toArray(results);
-        
-        final SearchResponse response = new SearchResponse(ids);
-        responder.respond(response);
-        boolean omitExpunged = (!useUids);
-        unsolicitedResponses(session, responder, omitExpunged, useUids);
-        okComplete(command, tag, responder);
+            ImapSession session, String tag, ImapCommand command, Responder responder) {
+        try {
+            final SearchRequest request = (SearchRequest) message;
+            final SearchKey searchKey = request.getSearchKey();
+            final boolean useUids = request.isUseUids();
+            ImapMailbox mailbox = ImapSessionUtils.getMailbox(session);
+            final FetchGroup fetchGroup = FetchGroupImpl.MINIMAL;
+    
+            final SearchQuery query = toQuery(searchKey, session);
+            
+            final Collection results = findIds(useUids, session, mailbox, fetchGroup, query);
+            final long[] ids = toArray(results);
+            
+            final SearchResponse response = new SearchResponse(ids);
+            responder.respond(response);
+            boolean omitExpunged = (!useUids);
+            unsolicitedResponses(session, responder, omitExpunged, useUids);
+            okComplete(command, tag, responder);
+        } catch (MailboxManagerException e) {
+            no(command, tag, responder, e);
+        }
     }
 
     private long[] toArray(final Collection results) {
@@ -101,14 +94,9 @@
         return ids;
     }
 
-    private Collection findIds(final boolean useUids, final ImapSession session, ImapMailbox mailbox, final FetchGroup fetchGroup, final SearchQuery query) throws MailboxException {
-        final Iterator it;
-        try {
-            
-            it = mailbox.search(query, fetchGroup, ImapSessionUtils.getMailboxSession(session));
-        } catch (MailboxManagerException e) {
-            throw new MailboxException(e);
-        }
+    private Collection findIds(final boolean useUids, final ImapSession session, ImapMailbox mailbox, 
+            final FetchGroup fetchGroup, final SearchQuery query) throws MailboxManagerException {
+        final Iterator it = mailbox.search(query, fetchGroup, ImapSessionUtils.getMailboxSession(session));
 
         final Collection results = new TreeSet();
         while (it.hasNext()) {

Modified: james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/StatusProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/StatusProcessor.java?rev=643130&r1=643129&r2=643130&view=diff
==============================================================================
--- james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/StatusProcessor.java (original)
+++ james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/StatusProcessor.java Mon Mar 31 13:25:17 2008
@@ -22,7 +22,6 @@
 import org.apache.avalon.framework.logger.Logger;
 import org.apache.james.api.imap.ImapCommand;
 import org.apache.james.api.imap.ImapMessage;
-import org.apache.james.api.imap.ProtocolException;
 import org.apache.james.api.imap.message.StatusDataItems;
 import org.apache.james.api.imap.message.request.ImapRequest;
 import org.apache.james.api.imap.message.response.imap4rev1.StatusResponseFactory;
@@ -31,9 +30,7 @@
 import org.apache.james.imap.message.request.imap4rev1.StatusRequest;
 import org.apache.james.imap.message.response.imap4rev1.server.STATUSResponse;
 import org.apache.james.imapserver.processor.base.AbstractMailboxAwareProcessor;
-import org.apache.james.imapserver.processor.base.AuthorizationException;
 import org.apache.james.imapserver.processor.base.ImapSessionUtils;
-import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.mailboxmanager.MailboxManagerException;
 import org.apache.james.mailboxmanager.MailboxSession;
 import org.apache.james.mailboxmanager.mailbox.ImapMailbox;
@@ -52,8 +49,7 @@
     }
 
     protected void doProcess(ImapRequest message,
-            ImapSession session, String tag, ImapCommand command, Responder responder)
-            throws MailboxException, AuthorizationException, ProtocolException {
+            ImapSession session, String tag, ImapCommand command, Responder responder) {
         final StatusRequest request = (StatusRequest) message;
         final String mailboxName = request.getMailboxName();
         final StatusDataItems statusDataItems = request.getStatusDataItems();
@@ -80,16 +76,12 @@
             
             final STATUSResponse response = new STATUSResponse(messages, recent, uidNext, uidValidity, unseen, mailboxName);
             responder.respond(response);
+            unsolicitedResponses(session, responder, false);
+            okComplete(command, tag, responder);
             
         } catch (MailboxManagerException e) {
-            if (logger != null && logger.isDebugEnabled()) {
-                logger.debug("STATUS command failed: ", e);
-            }
-            throw new MailboxException(e);
+            no(command, tag, responder, e);
         }
-        
-        unsolicitedResponses(session, responder, false);
-        okComplete(command, tag, responder);
     }
 
     private Long unseen(final StatusDataItems statusDataItems, final MailboxSession mailboxSession, final ImapMailbox mailbox) throws MailboxManagerException {

Modified: james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/StoreProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/StoreProcessor.java?rev=643130&r1=643129&r2=643130&view=diff
==============================================================================
--- james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/StoreProcessor.java (original)
+++ james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/StoreProcessor.java Mon Mar 31 13:25:17 2008
@@ -35,7 +35,6 @@
 import org.apache.james.imap.message.response.imap4rev1.FetchResponse;
 import org.apache.james.imapserver.processor.base.AbstractImapRequestProcessor;
 import org.apache.james.imapserver.processor.base.ImapSessionUtils;
-import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.mailboxmanager.GeneralMessageSet;
 import org.apache.james.mailboxmanager.MailboxManagerException;
 import org.apache.james.mailboxmanager.MailboxSession;
@@ -58,8 +57,7 @@
     }
 
     protected void doProcess(ImapRequest message,
-            ImapSession session, String tag, ImapCommand command, Responder responder)
-            throws MailboxException {
+            ImapSession session, String tag, ImapCommand command, Responder responder) {
         final StoreRequest request = (StoreRequest) message;
         final IdRange[] idSet = request.getIdSet();
         final Flags flags = request.getFlags();
@@ -119,12 +117,11 @@
                     }
                 }
             }
+            final boolean omitExpunged = (!useUids);
+            unsolicitedResponses(session, responder, omitExpunged, useUids);
+            okComplete(command, tag, responder);
         } catch (MailboxManagerException e) {
-            throw new MailboxException(e);
+            no(command, tag, responder, e);
         }
-
-        final boolean omitExpunged = (!useUids);
-        unsolicitedResponses(session, responder, omitExpunged, useUids);
-        okComplete(command, tag, responder);
     }
 }

Modified: james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/UnsubscribeProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/UnsubscribeProcessor.java?rev=643130&r1=643129&r2=643130&view=diff
==============================================================================
--- james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/UnsubscribeProcessor.java (original)
+++ james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/UnsubscribeProcessor.java Mon Mar 31 13:25:17 2008
@@ -21,7 +21,6 @@
 
 import org.apache.james.api.imap.ImapCommand;
 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.message.request.ImapRequest;
 import org.apache.james.api.imap.message.response.imap4rev1.StatusResponseFactory;
@@ -29,9 +28,7 @@
 import org.apache.james.api.imap.process.ImapSession;
 import org.apache.james.imap.message.request.imap4rev1.UnsubscribeRequest;
 import org.apache.james.imapserver.processor.base.AbstractImapRequestProcessor;
-import org.apache.james.imapserver.processor.base.AuthorizationException;
 import org.apache.james.imapserver.processor.base.ImapSessionUtils;
-import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.services.User;
 
 public class UnsubscribeProcessor extends AbstractImapRequestProcessor {
@@ -49,8 +46,7 @@
     }
 
     protected void doProcess(ImapRequest message,
-            ImapSession session, String tag, ImapCommand command, Responder responder)
-            throws MailboxException, AuthorizationException, ProtocolException {
+            ImapSession session, String tag, ImapCommand command, Responder responder) {
         final UnsubscribeRequest request = (UnsubscribeRequest) message;
         final String mailboxName = request.getMailboxName();
         final User user = ImapSessionUtils.getUser(session);



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