james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r993100 [2/3] - in /james/imap/trunk: api/ api/src/main/java/org/apache/james/imap/api/ api/src/main/java/org/apache/james/imap/api/process/ deployment/src/test/java/org/apache/james/imap/functional/ jcr/ jcr/src/main/java/org/apache/james/...
Date Mon, 06 Sep 2010 17:19:20 GMT
Modified: james/imap/trunk/maildir/src/main/java/org/apache/james/imap/maildir/MaildirStore.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/maildir/src/main/java/org/apache/james/imap/maildir/MaildirStore.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/maildir/src/main/java/org/apache/james/imap/maildir/MaildirStore.java (original)
+++ james/imap/trunk/maildir/src/main/java/org/apache/james/imap/maildir/MaildirStore.java Mon Sep  6 17:19:17 2010
@@ -21,10 +21,9 @@ package org.apache.james.imap.maildir;
 import java.io.File;
 import java.io.IOException;
 
-import org.apache.james.imap.api.MailboxPath;
-import org.apache.james.imap.api.display.HumanReadableText;
+import org.apache.james.imap.mailbox.MailboxException;
 import org.apache.james.imap.mailbox.MailboxNotFoundException;
-import org.apache.james.imap.mailbox.StorageException;
+import org.apache.james.imap.mailbox.MailboxPath;
 import org.apache.james.imap.maildir.mail.model.MaildirMailbox;
 import org.apache.james.imap.store.mail.model.Mailbox;
 
@@ -69,9 +68,9 @@ public class MaildirStore {
      * @param user The owner of this mailbox
      * @param folderName The name of the mailbox folder
      * @return The Mailbox object populated with data from the file system
-     * @throws StorageException If the mailbox folder doesn't exist or can't be read
+     * @throws MailboxException If the mailbox folder doesn't exist or can't be read
      */
-    public Mailbox<Integer> loadMailbox(File root, String namespace, String user, String folderName) throws StorageException {
+    public Mailbox<Integer> loadMailbox(File root, String namespace, String user, String folderName) throws MailboxException {
         String mailboxName = getMailboxNameFromFolderName(folderName);
         return loadMailbox(new File(root, folderName), new MailboxPath(namespace, user, mailboxName));
     }
@@ -81,10 +80,10 @@ public class MaildirStore {
      * @param mailboxPath The path of the mailbox
      * @return The Mailbox object populated with data from the file system
      * @throws MailboxNotFoundException If the mailbox folder doesn't exist
-     * @throws StorageException If the mailbox folder can't be read
+     * @throws MailboxException If the mailbox folder can't be read
      */
     public Mailbox<Integer> loadMailbox(MailboxPath mailboxPath)
-    throws MailboxNotFoundException, StorageException {
+    throws MailboxNotFoundException, MailboxException {
         String folder = getFolderName(mailboxPath);
         File f = new File(folder);
         if (!f.isDirectory())
@@ -97,9 +96,9 @@ public class MaildirStore {
      * @param mailboxFile File object referencing the folder for the mailbox
      * @param mailboxPath The path of the mailbox
      * @return The Mailbox object populated with data from the file system
-     * @throws StorageException If the mailbox folder doesn't exist or can't be read
+     * @throws MailboxException If the mailbox folder doesn't exist or can't be read
      */
-    public Mailbox<Integer> loadMailbox(File mailboxFile, MailboxPath mailboxPath) throws StorageException {
+    public Mailbox<Integer> loadMailbox(File mailboxFile, MailboxPath mailboxPath) throws MailboxException {
         long uidValidity;
         long lastUid;
         MaildirFolder folder = new MaildirFolder(mailboxFile.getAbsolutePath());
@@ -107,7 +106,7 @@ public class MaildirStore {
             uidValidity = folder.getUidValidity();
             lastUid = folder.getLastUid();
         } catch (IOException e) {
-            throw new StorageException(HumanReadableText.SELECT, null);
+            throw new MailboxException("Unable to load Mailbox " + mailboxPath, e);
         }
         return new MaildirMailbox(mailboxPath, uidValidity, lastUid);
     }
@@ -133,13 +132,13 @@ public class MaildirStore {
      * The main maildir folder containing all mailboxes for one user
      * @param user The user name of a mailbox
      * @return A File object referencing the main maildir folder
-     * @throws StorageException If the folder does not exist or is no directory
+     * @throws MailboxException If the folder does not exist or is no directory
      */
-    public File getMailboxRootForUser(String user) throws StorageException {
+    public File getMailboxRootForUser(String user) throws MailboxException {
         String path = userRoot(user);
         File root = new File(path);
         if (!root.isDirectory())
-            throw new StorageException(HumanReadableText.MAILBOX_NOT_FOUND, null);
+            throw new MailboxException("Unable to load Mailbox for user " + user);
         return root;
     }
     

Modified: james/imap/trunk/maildir/src/main/java/org/apache/james/imap/maildir/mail/MaildirMailboxMapper.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/maildir/src/main/java/org/apache/james/imap/maildir/mail/MaildirMailboxMapper.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/maildir/src/main/java/org/apache/james/imap/maildir/mail/MaildirMailboxMapper.java (original)
+++ james/imap/trunk/maildir/src/main/java/org/apache/james/imap/maildir/mail/MaildirMailboxMapper.java Mon Sep  6 17:19:17 2010
@@ -27,10 +27,10 @@ import java.util.regex.Pattern;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang.NotImplementedException;
-import org.apache.james.imap.api.MailboxPath;
-import org.apache.james.imap.api.display.HumanReadableText;
+import org.apache.james.imap.mailbox.MailboxException;
+import org.apache.james.imap.mailbox.MailboxExistsException;
 import org.apache.james.imap.mailbox.MailboxNotFoundException;
-import org.apache.james.imap.mailbox.StorageException;
+import org.apache.james.imap.mailbox.MailboxPath;
 import org.apache.james.imap.maildir.MaildirFolder;
 import org.apache.james.imap.maildir.MaildirMessageName;
 import org.apache.james.imap.maildir.MaildirStore;
@@ -59,26 +59,25 @@ public class MaildirMailboxMapper extend
      * (non-Javadoc)
      * @see org.apache.james.imap.store.mail.MailboxMapper#delete(org.apache.james.imap.store.mail.model.Mailbox)
      */
-    public void delete(Mailbox<Integer> mailbox) throws StorageException {
+    public void delete(Mailbox<Integer> mailbox) throws MailboxException {
         String folderName = maildirStore.getFolderName(mailbox);
         File folder = new File(folderName);
         if (folder.isDirectory()) {
             try {
                 FileUtils.deleteDirectory(folder);
             } catch (IOException e) {
-                throw new StorageException(HumanReadableText.DELETED_FAILED, e);
+                throw new MailboxException("Unable to delete Mailbox " + mailbox, e);
             }
         }
         else
-            throw new StorageException(HumanReadableText.DELETED_FAILED,
-                    new MailboxNotFoundException(mailbox.getName()));
+            throw new MailboxNotFoundException(mailbox.getName());
     }
 
     /*
      * (non-Javadoc)
      * @see org.apache.james.imap.store.mail.MailboxMapper#deleteAll()
      */
-    public void deleteAll() throws StorageException {
+    public void deleteAll() throws MailboxException {
         // not used
         throw new NotImplementedException();
     }
@@ -87,7 +86,7 @@ public class MaildirMailboxMapper extend
      * (non-Javadoc)
      * @see org.apache.james.imap.store.mail.MailboxMapper#findMailboxById(java.lang.Object)
      */
-    public Mailbox<Integer> findMailboxById(Integer mailboxId) throws StorageException,
+    public Mailbox<Integer> findMailboxById(Integer mailboxId) throws MailboxException,
             MailboxNotFoundException {
         // not used
         throw new NotImplementedException();
@@ -98,7 +97,7 @@ public class MaildirMailboxMapper extend
      * @see org.apache.james.imap.store.mail.MailboxMapper#findMailboxByPath(org.apache.james.imap.api.MailboxPath)
      */
     public Mailbox<Integer> findMailboxByPath(MailboxPath mailboxPath)
-            throws StorageException, MailboxNotFoundException {
+            throws MailboxException, MailboxNotFoundException {
         String folder = maildirStore.getFolderName(mailboxPath);
         File f = new File(folder);
         if (!f.isDirectory())
@@ -112,7 +111,7 @@ public class MaildirMailboxMapper extend
      * @see org.apache.james.imap.store.mail.MailboxMapper#findMailboxWithPathLike(org.apache.james.imap.api.MailboxPath)
      */
     public List<Mailbox<Integer>> findMailboxWithPathLike(MailboxPath mailboxPath)
-            throws StorageException {
+            throws MailboxException {
         final Pattern searchPattern = Pattern.compile("[" + MaildirStore.maildirDelimiter + "]"
                 + mailboxPath.getName().replace(".", "\\.").replace(MaildirStore.WILDCARD, ".*"));
         FilenameFilter filter = MaildirMessageName.createRegexFilter(searchPattern);
@@ -136,7 +135,7 @@ public class MaildirMailboxMapper extend
      * (non-Javadoc)
      * @see org.apache.james.imap.store.mail.MailboxMapper#hasChildren(org.apache.james.imap.store.mail.model.Mailbox)
      */
-    public boolean hasChildren(Mailbox<Integer> mailbox) throws StorageException, MailboxNotFoundException {
+    public boolean hasChildren(Mailbox<Integer> mailbox) throws MailboxException, MailboxNotFoundException {
         String searchString = mailbox.getName() + MaildirStore.maildirDelimiter + MaildirStore.WILDCARD;
         List<Mailbox<Integer>> mailboxes = findMailboxWithPathLike(
                 new MailboxPath(mailbox.getNamespace(), mailbox.getUser(), searchString));
@@ -147,13 +146,13 @@ public class MaildirMailboxMapper extend
      * (non-Javadoc)
      * @see org.apache.james.imap.store.mail.MailboxMapper#save(org.apache.james.imap.store.mail.model.Mailbox)
      */
-    public void save(Mailbox<Integer> mailbox) throws StorageException {
+    public void save(Mailbox<Integer> mailbox) throws MailboxException {
         try {
             Mailbox<Integer> originalMailbox = getCachedMailbox(mailbox.getMailboxId());
             MaildirFolder folder = maildirStore.createMaildirFolder(mailbox);
             if (originalMailbox.getName() != mailbox.getName()) {
                 if (folder.exists())
-                    throw new StorageException(HumanReadableText.MAILBOX_EXISTS, null);
+                    throw new MailboxExistsException(mailbox.getName());
                 
                 MaildirFolder originalFolder = maildirStore.createMaildirFolder(originalMailbox);
                 // renaming the INBOX means to move its contents to the new folder 
@@ -161,7 +160,7 @@ public class MaildirMailboxMapper extend
                     File inboxFolder = originalFolder.getRootFile();
                     File newFolder = folder.getRootFile();
                     if (!newFolder.mkdirs())
-                        throw new StorageException(HumanReadableText.SAVE_FAILED, null);
+                        throw new MailboxException("Failed to saveMailbox " + mailbox);
                     originalFolder.getCurFolder().renameTo(folder.getCurFolder());
                     originalFolder.getNewFolder().renameTo(folder.getNewFolder());
                     originalFolder.getTmpFolder().renameTo(folder.getTmpFolder());
@@ -177,7 +176,7 @@ public class MaildirMailboxMapper extend
                 }
                 else {
                     if (!originalFolder.getRootFile().renameTo(folder.getRootFile()))
-                        throw new StorageException(HumanReadableText.SAVE_FAILED, 
+                        throw new MailboxException("Failed to save Mailbox " + mailbox, 
                                 new IOException("Could not rename folder " + originalFolder));
                 }
             }
@@ -187,17 +186,19 @@ public class MaildirMailboxMapper extend
             if (!folder.exists()) {
                 boolean success = folder.getRootFile().mkdirs();
                 if (!success)
-                    throw new StorageException(HumanReadableText.SAVE_FAILED, null);
+                    throw new MailboxException("Failed to save Mailbox " + mailbox);
                 success = folder.getCurFolder().mkdir();
                 success = success && folder.getNewFolder().mkdir();
                 success = success && folder.getTmpFolder().mkdir();
                 if (!success)
-                    throw new StorageException(HumanReadableText.SAVE_FAILED, new IOException("Needed folder structure can not be created"));
+                    throw new MailboxException("Failed to save Mailbox " + mailbox, new IOException("Needed folder structure can not be created"));
+
             }
             try {
                 folder.setUidValidity(mailbox.getUidValidity());
             } catch (IOException ioe) {
-                throw new StorageException(HumanReadableText.SAVE_FAILED, ioe);
+                throw new MailboxException("Failed to save Mailbox " + mailbox, ioe);
+
             }
         }
         
@@ -236,7 +237,7 @@ public class MaildirMailboxMapper extend
         try {
             return mailboxCache.get(mailboxId);
         } catch (IndexOutOfBoundsException e) {
-            throw new MailboxNotFoundException(mailboxId);
+            throw new MailboxNotFoundException(String.valueOf(mailboxId));
         }
     }
 

Modified: james/imap/trunk/maildir/src/main/java/org/apache/james/imap/maildir/mail/MaildirMessageMapper.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/maildir/src/main/java/org/apache/james/imap/maildir/mail/MaildirMessageMapper.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/maildir/src/main/java/org/apache/james/imap/maildir/mail/MaildirMessageMapper.java (original)
+++ james/imap/trunk/maildir/src/main/java/org/apache/james/imap/maildir/mail/MaildirMessageMapper.java Mon Sep  6 17:19:17 2010
@@ -35,11 +35,9 @@ import java.util.Map.Entry;
 import javax.mail.util.SharedFileInputStream;
 
 import org.apache.commons.io.FileUtils;
-import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.mailbox.MailboxException;
 import org.apache.james.imap.mailbox.MessageRange;
 import org.apache.james.imap.mailbox.SearchQuery;
-import org.apache.james.imap.mailbox.StorageException;
 import org.apache.james.imap.mailbox.MessageRange.Type;
 import org.apache.james.imap.mailbox.SearchQuery.Criterion;
 import org.apache.james.imap.mailbox.SearchQuery.NumericRange;
@@ -78,13 +76,9 @@ public class MaildirMessageMapper extend
      * @see org.apache.james.imap.store.mail.MessageMapper#copy(org.apache.james.imap.store.mail.model.Mailbox, org.apache.james.imap.store.mail.model.MailboxMembership)
      */
     public long copy(Mailbox<Integer> mailbox, MailboxMembership<Integer> original)
-    throws StorageException {
-        MaildirMessage theCopy;
-        try {
-            theCopy = new MaildirMessage(mailbox, (MaildirMessage) original);
-        } catch (MailboxException e) {
-            throw new StorageException(HumanReadableText.FAILURE_MAIL_PARSE, e);
-        }
+    throws MailboxException {
+        MaildirMessage theCopy = new MaildirMessage(mailbox, (MaildirMessage) original);
+
         return save(mailbox, theCopy);
     }
 
@@ -92,14 +86,14 @@ public class MaildirMessageMapper extend
      * (non-Javadoc)
      * @see org.apache.james.imap.store.mail.MessageMapper#countMessagesInMailbox(org.apache.james.imap.store.mail.model.Mailbox)
      */
-    public long countMessagesInMailbox(Mailbox<Integer> mailbox) throws StorageException {
+    public long countMessagesInMailbox(Mailbox<Integer> mailbox) throws MailboxException {
         MaildirFolder folder = maildirStore.createMaildirFolder(mailbox);
         File newFolder = folder.getNewFolder();
         File curFolder = folder.getCurFolder();
         File[] newFiles = newFolder.listFiles();
         File[] curFiles = curFolder.listFiles();
         if (newFiles == null || curFiles == null)
-            throw new StorageException(HumanReadableText.COUNT_FAILED,
+            throw new MailboxException("Unable to count messages in Mailbox " + mailbox,
                     new IOException("Not a valid Maildir folder: " + maildirStore.getFolderName(mailbox)));
         int count = newFiles.length + curFiles.length;
         return count;
@@ -109,14 +103,14 @@ public class MaildirMessageMapper extend
      * (non-Javadoc)
      * @see org.apache.james.imap.store.mail.MessageMapper#countUnseenMessagesInMailbox(org.apache.james.imap.store.mail.model.Mailbox)
      */
-    public long countUnseenMessagesInMailbox(Mailbox<Integer> mailbox) throws StorageException {
+    public long countUnseenMessagesInMailbox(Mailbox<Integer> mailbox) throws MailboxException {
         MaildirFolder folder = maildirStore.createMaildirFolder(mailbox);
         File newFolder = folder.getNewFolder();
         File curFolder = folder.getCurFolder();
         String[] unseenMessages = curFolder.list(MaildirMessageName.FILTER_UNSEEN_MESSAGES);
         String[] newUnseenMessages = newFolder.list(MaildirMessageName.FILTER_UNSEEN_MESSAGES);
         if (newUnseenMessages == null || unseenMessages == null)
-            throw new StorageException(HumanReadableText.COUNT_FAILED,
+            throw new MailboxException("Unable to count unseen messages in Mailbox " + mailbox,
                     new IOException("Not a valid Maildir folder: " + maildirStore.getFolderName(mailbox)));
         int count = newUnseenMessages.length + unseenMessages.length;
         return count;
@@ -126,12 +120,12 @@ public class MaildirMessageMapper extend
      * (non-Javadoc)
      * @see org.apache.james.imap.store.mail.MessageMapper#delete(org.apache.james.imap.store.mail.model.Mailbox, org.apache.james.imap.store.mail.model.MailboxMembership)
      */
-    public void delete(Mailbox<Integer> mailbox, MailboxMembership<Integer> message) throws StorageException {
+    public void delete(Mailbox<Integer> mailbox, MailboxMembership<Integer> message) throws MailboxException {
         MaildirFolder folder = maildirStore.createMaildirFolder(mailbox);
         try {
             folder.delete(message.getUid());
         } catch (IOException e) {
-            throw new StorageException(HumanReadableText.DELETED_FAILED, e);
+            throw new MailboxException("Unable to delete Message " + message + " in Mailbox " + mailbox, e);
         }
     }
 
@@ -140,7 +134,7 @@ public class MaildirMessageMapper extend
      * @see org.apache.james.imap.store.mail.MessageMapper#findInMailbox(org.apache.james.imap.store.mail.model.Mailbox, org.apache.james.imap.mailbox.MessageRange)
      */
     public List<MailboxMembership<Integer>> findInMailbox(Mailbox<Integer> mailbox, MessageRange set)
-    throws StorageException {
+    throws MailboxException {
         final List<MailboxMembership<Integer>> results;
         final long from = set.getUidFrom();
         final long to = set.getUidTo();
@@ -164,13 +158,13 @@ public class MaildirMessageMapper extend
     }
 
     private List<MailboxMembership<Integer>> findMessageInMailboxWithUID(Mailbox<Integer> mailbox, long uid)
-    throws StorageException {
+    throws MailboxException {
         MaildirFolder folder = maildirStore.createMaildirFolder(mailbox);
         MaildirMessageName messageName = null;
         try {
              messageName = folder.getMessageNameByUid(uid);
         } catch (IOException e) {
-            throw new StorageException(HumanReadableText.SEARCH_FAILED, e);
+            throw new MailboxException("Failure while search for Message with uid " + uid + " in Mailbox " + mailbox, e );
         }
         ArrayList<MailboxMembership<Integer>> messages = new ArrayList<MailboxMembership<Integer>>();
         if (messageName != null) {
@@ -181,7 +175,7 @@ public class MaildirMessageMapper extend
     }
 
     private List<MailboxMembership<Integer>> findMessagesInMailboxBetweenUIDs(Mailbox<Integer> mailbox,
-            FilenameFilter filter, long from, long to) throws StorageException {
+            FilenameFilter filter, long from, long to) throws MailboxException {
         MaildirFolder folder = maildirStore.createMaildirFolder(mailbox);
         SortedMap<Long, MaildirMessageName> uidMap = null;
         try {
@@ -190,7 +184,7 @@ public class MaildirMessageMapper extend
             else
                 uidMap = folder.getUidMap(from, to);
         } catch (IOException e) {
-            throw new StorageException(HumanReadableText.SEARCH_FAILED, e);
+            throw new MailboxException("Failure while search for Messages in Mailbox " + mailbox, e );
         }
         ArrayList<MailboxMembership<Integer>> messages = new ArrayList<MailboxMembership<Integer>>();
         for (Entry<Long, MaildirMessageName> entry : uidMap.entrySet()) {
@@ -203,7 +197,7 @@ public class MaildirMessageMapper extend
      * (non-Javadoc)
      * @see org.apache.james.imap.store.mail.MessageMapper#findMarkedForDeletionInMailbox(org.apache.james.imap.store.mail.model.Mailbox, org.apache.james.imap.mailbox.MessageRange)
      */
-    public List<MailboxMembership<Integer>> findMarkedForDeletionInMailbox(Mailbox<Integer> mailbox, MessageRange set) throws StorageException {
+    public List<MailboxMembership<Integer>> findMarkedForDeletionInMailbox(Mailbox<Integer> mailbox, MessageRange set) throws MailboxException {
         List<MailboxMembership<Integer>> results = new ArrayList<MailboxMembership<Integer>>();
         final long from = set.getUidFrom();
         final long to = set.getUidTo();
@@ -227,13 +221,13 @@ public class MaildirMessageMapper extend
     }
 
     private List<MailboxMembership<Integer>> findMessagesInMailbox(Mailbox<Integer> mailbox,
-            FilenameFilter filter, int limit) throws StorageException {
+            FilenameFilter filter, int limit) throws MailboxException {
         MaildirFolder folder = maildirStore.createMaildirFolder(mailbox);
         SortedMap<Long, MaildirMessageName> uidMap = null;
         try {
             uidMap = folder.getUidMap(filter, limit);
         } catch (IOException e) {
-            throw new StorageException(HumanReadableText.SEARCH_FAILED, e);
+            throw new MailboxException("Failure while search for Messages in Mailbox " + mailbox, e );
         }
         ArrayList<MailboxMembership<Integer>> filtered = new ArrayList<MailboxMembership<Integer>>(uidMap.size());
         for (Entry<Long, MaildirMessageName> entry : uidMap.entrySet())
@@ -242,13 +236,13 @@ public class MaildirMessageMapper extend
     }
 
     private List<MailboxMembership<Integer>> findDeletedMessageInMailboxWithUID(
-            Mailbox<Integer> mailbox, long uid) throws StorageException {
+            Mailbox<Integer> mailbox, long uid) throws MailboxException {
         MaildirFolder folder = maildirStore.createMaildirFolder(mailbox);
         MaildirMessageName messageName = null;
         try {
              messageName = folder.getMessageNameByUid(uid);
         } catch (IOException e) {
-            throw new StorageException(HumanReadableText.SEARCH_FAILED, e);
+            throw new MailboxException("Failure while search for Messages in Mailbox " + mailbox, e );
         }
         ArrayList<MailboxMembership<Integer>> messages = new ArrayList<MailboxMembership<Integer>>();
         if (MaildirMessageName.FILTER_DELETED_MESSAGES.accept(null, messageName.getFullName())) {
@@ -263,13 +257,13 @@ public class MaildirMessageMapper extend
      * @see org.apache.james.imap.store.mail.MessageMapper#findRecentMessagesInMailbox(org.apache.james.imap.store.mail.model.Mailbox, int)
      */
     public List<MailboxMembership<Integer>> findRecentMessagesInMailbox(Mailbox<Integer> mailbox, int limit)
-    throws StorageException {
+    throws MailboxException {
         MaildirFolder folder = maildirStore.createMaildirFolder(mailbox);
         SortedMap<Long, MaildirMessageName> recentMessageNames;
         try {
             recentMessageNames = folder.getRecentMessages(limit);
         } catch (IOException e) {
-            throw new StorageException(HumanReadableText.SEARCH_FAILED, e);
+            throw new MailboxException("Failure while search recent messages in Mailbox " + mailbox, e );
         }
         List<MailboxMembership<Integer>> recentMessages = new ArrayList<MailboxMembership<Integer>>(recentMessageNames.size());
         for (Entry<Long, MaildirMessageName> entry : recentMessageNames.entrySet())
@@ -282,7 +276,7 @@ public class MaildirMessageMapper extend
      * @see org.apache.james.imap.store.mail.MessageMapper#findFirstUnseenMessageUid(org.apache.james.imap.store.mail.model.Mailbox)
      */
     public Long findFirstUnseenMessageUid(Mailbox<Integer> mailbox)
-    throws StorageException {
+    throws MailboxException {
         List<MailboxMembership<Integer>> result = findMessagesInMailbox(mailbox, MaildirMessageName.FILTER_UNSEEN_MESSAGES, 1);
         if (result.isEmpty()) {
             return null;
@@ -297,7 +291,7 @@ public class MaildirMessageMapper extend
      * org.apache.james.imap.store.mail.model.MailboxMembership)
      */
     public long save(Mailbox<Integer> mailbox, MailboxMembership<Integer> message)
-    throws StorageException {
+    throws MailboxException {
         MaildirMessage maildirMessage = (MaildirMessage) message;
         MaildirFolder folder = maildirStore.createMaildirFolder(mailbox);
         long uid = 0;
@@ -325,7 +319,7 @@ public class MaildirMessageMapper extend
                     fos.write(b, 0, len);
             }
             catch (IOException ioe) {
-                throw new StorageException(HumanReadableText.SAVE_FAILED, ioe);
+                throw new MailboxException("Failure while save Message " + message + " in Mailbox " + mailbox, ioe );
             }
             finally {
                 try {
@@ -353,12 +347,12 @@ public class MaildirMessageMapper extend
             } catch (IOException e) {
                 System.err.println(newMessageFile);
                 // TODO: Try copy and delete
-                throw new StorageException(HumanReadableText.SAVE_FAILED, e);
+                throw new MailboxException("Failure while save Message " + message + " in Mailbox " + mailbox, e );
             }
             try {
                 uid = folder.appendMessage(newMessageFile.getName());
             } catch (IOException e) {
-                throw new StorageException(HumanReadableText.SAVE_FAILED, e);
+                throw new MailboxException("Failure while save Message " + message + " in Mailbox " + mailbox, e );
             }
         }
         // the message already exists and its flags need to be updated (everything else is immutable)
@@ -374,7 +368,7 @@ public class MaildirMessageMapper extend
                 uid = message.getUid();
                 folder.update(uid, newMessageName);
             } catch (IOException e) {
-                throw new StorageException(HumanReadableText.SAVE_FAILED, e);
+                throw new MailboxException("Failure while save Message " + message + " in Mailbox " + mailbox, e );
             }
         }
         return uid;
@@ -386,7 +380,7 @@ public class MaildirMessageMapper extend
      * @see org.apache.james.imap.store.mail.MessageMapper#searchMailbox(org.apache.james.imap.store.mail.model.Mailbox, org.apache.james.imap.mailbox.SearchQuery)
      */
     public Iterator<Long> searchMailbox(Mailbox<Integer> mailbox, SearchQuery query)
-    throws StorageException {
+    throws MailboxException {
         final List<Criterion> criteria = query.getCriterias();
         boolean range = false;
         int rangeLength = -1;
@@ -421,7 +415,7 @@ public class MaildirMessageMapper extend
         try {
             uidMap = folder.getUidMap(0, -1);
         } catch (IOException e) {
-            throw new StorageException(HumanReadableText.SEARCH_FAILED, e);
+            throw new MailboxException("Failure while search in Mailbox " + mailbox, e );
         }
         LinkedList<MailboxMembership<?>> messages = new LinkedList<MailboxMembership<?>>();
         for (Entry<Long, MaildirMessageName> entry : uidMap.entrySet()) {
@@ -450,16 +444,16 @@ public class MaildirMessageMapper extend
      * @param mailbox The mailbox which the message resides in
      * @param messageName The name of the message
      * @return the {@link MaildirMessage} filled with data from the respective file
-     * @throws StorageException if there was an error parsing the message or the message could not be found
+     * @throws MailboxException if there was an error parsing the message or the message could not be found
      */
     private MaildirMessage loadMessage(Mailbox<Integer> mailbox, MaildirMessageName messageName, Long uid)
-    throws StorageException {
+    throws MailboxException {
         MaildirMessage message = null;
         try {
             File messageFile = messageName.getFile();
             message = parseMessage(messageFile, mailbox);
         } catch (IOException e) {
-            throw new StorageException(HumanReadableText.FAILURE_MAIL_PARSE, e);
+            throw new MailboxException("Parsing of message failed in Mailbox " + mailbox, e );
         }
         message.setFlags(messageName.getFlags());
         message.setInternalDate(messageName.getInternalDate());

Modified: james/imap/trunk/maildir/src/main/java/org/apache/james/imap/maildir/mail/model/MaildirMailbox.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/maildir/src/main/java/org/apache/james/imap/maildir/mail/model/MaildirMailbox.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/maildir/src/main/java/org/apache/james/imap/maildir/mail/model/MaildirMailbox.java (original)
+++ james/imap/trunk/maildir/src/main/java/org/apache/james/imap/maildir/mail/model/MaildirMailbox.java Mon Sep  6 17:19:17 2010
@@ -1,169 +1,169 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-package org.apache.james.imap.maildir.mail.model;
-
-import org.apache.james.imap.api.MailboxPath;
-import org.apache.james.imap.store.mail.model.Mailbox;
-
-public class MaildirMailbox implements Mailbox<Integer> {
-
-    private Integer id = null;
-    private String namespace;
-    private String user;
-    private String name;
-	private long lastUid;
-	private long uidValidity;
-
-    public MaildirMailbox(MailboxPath path, long uidValidity, long lastUid) {
-        this.namespace = path.getNamespace();
-        this.user = path.getUser();
-        this.name = path.getName();
-        this.uidValidity = uidValidity;
-        this.lastUid = lastUid;
-    }
-    
-    public MaildirMailbox(Mailbox<Integer> mailbox) {
-        this.id = mailbox.getMailboxId();
-        this.namespace = mailbox.getNamespace();
-        this.user = mailbox.getUser();
-        this.name = mailbox.getName();
-        this.lastUid = mailbox.getLastUid();
-        this.uidValidity = mailbox.getUidValidity();
-    }
-
-	/*
-	 * (non-Javadoc)
-	 * @see org.apache.james.imap.store.mail.model.Mailbox#consumeUid()
-	 */
-	public void consumeUid() {
-		lastUid++;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * @see org.apache.james.imap.store.mail.model.Mailbox#getLastUid()
-	 */
-	public long getLastUid() {
-		return lastUid;
-	}
-	
-	public void setMailboxId(Integer id) {
-        this.id = id;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * @see org.apache.james.imap.store.mail.model.Mailbox#getMailboxId()
-	 */
-	public Integer getMailboxId() {
-	    return id;
-	}
-
-    /* (non-Javadoc)
-     * @see org.apache.james.imap.store.mail.model.Mailbox#getNamespace()
-     */
-    public String getNamespace() {
-        return namespace;
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.james.imap.store.mail.model.Mailbox#setNamespace(java.lang.String)
-     */
-    public void setNamespace(String namespace) {
-        this.namespace = namespace;
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.james.imap.store.mail.model.Mailbox#getUser()
-     */
-    public String getUser() {
-        return user;
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.james.imap.store.mail.model.Mailbox#setUser(java.lang.String)
-     */
-    public void setUser(String user) {
-        this.user = user;
-    }
-
-	/*
-	 * (non-Javadoc)
-	 * @see org.apache.james.imap.store.mail.model.Mailbox#getName()
-	 */
-	public String getName() {
-		return name;
-	}
-
-    /*
-     * (non-Javadoc)
-     * @see org.apache.james.imap.store.mail.model.Mailbox#setName(java.lang.String)
-     */
-    public void setName(String name) {
-        this.name = name;
-    }
-
-	/*
-	 * (non-Javadoc)
-	 * @see org.apache.james.imap.store.mail.model.Mailbox#getUidValidity()
-	 */
-	public long getUidValidity() {
-		return uidValidity;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * @see java.lang.Object#equals(java.lang.Object)
-	 */
-	public boolean equals(Object obj) {
-		if (obj == this) {
-			return true;
-		}
-		if (obj instanceof MaildirMailbox) {
-			if (id == ((MaildirMailbox) obj).getMailboxId()) {
-				return true;
-			}
-		}
-		return false;
-	}
-
-	/* 
-	 * (non-Javadoc)
-	 * @see java.lang.Object#hashCode()
-	 */
-	@Override
-	public int hashCode() {
-	    final int PRIME = 31;
-        int result = 1;
-        result = PRIME * result + namespace.hashCode();
-        result = PRIME * result + user.hashCode();
-        result = PRIME * result + name.hashCode();
-        return result;
-	}
-	
-	/* 
-	 * (non-Javadoc)
-	 * @see java.lang.Object#toString()
-	 */
-	@Override
-	public String toString() {
-	    return namespace + ":" + user + ":" + name;
-	}
-
-}
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+package org.apache.james.imap.maildir.mail.model;
+
+import org.apache.james.imap.mailbox.MailboxPath;
+import org.apache.james.imap.store.mail.model.Mailbox;
+
+public class MaildirMailbox implements Mailbox<Integer> {
+
+    private Integer id = null;
+    private String namespace;
+    private String user;
+    private String name;
+	private long lastUid;
+	private long uidValidity;
+
+    public MaildirMailbox(MailboxPath path, long uidValidity, long lastUid) {
+        this.namespace = path.getNamespace();
+        this.user = path.getUser();
+        this.name = path.getName();
+        this.uidValidity = uidValidity;
+        this.lastUid = lastUid;
+    }
+    
+    public MaildirMailbox(Mailbox<Integer> mailbox) {
+        this.id = mailbox.getMailboxId();
+        this.namespace = mailbox.getNamespace();
+        this.user = mailbox.getUser();
+        this.name = mailbox.getName();
+        this.lastUid = mailbox.getLastUid();
+        this.uidValidity = mailbox.getUidValidity();
+    }
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.apache.james.imap.store.mail.model.Mailbox#consumeUid()
+	 */
+	public void consumeUid() {
+		lastUid++;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.apache.james.imap.store.mail.model.Mailbox#getLastUid()
+	 */
+	public long getLastUid() {
+		return lastUid;
+	}
+	
+	public void setMailboxId(Integer id) {
+        this.id = id;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.apache.james.imap.store.mail.model.Mailbox#getMailboxId()
+	 */
+	public Integer getMailboxId() {
+	    return id;
+	}
+
+    /* (non-Javadoc)
+     * @see org.apache.james.imap.store.mail.model.Mailbox#getNamespace()
+     */
+    public String getNamespace() {
+        return namespace;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.james.imap.store.mail.model.Mailbox#setNamespace(java.lang.String)
+     */
+    public void setNamespace(String namespace) {
+        this.namespace = namespace;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.james.imap.store.mail.model.Mailbox#getUser()
+     */
+    public String getUser() {
+        return user;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.james.imap.store.mail.model.Mailbox#setUser(java.lang.String)
+     */
+    public void setUser(String user) {
+        this.user = user;
+    }
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.apache.james.imap.store.mail.model.Mailbox#getName()
+	 */
+	public String getName() {
+		return name;
+	}
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.james.imap.store.mail.model.Mailbox#setName(java.lang.String)
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.apache.james.imap.store.mail.model.Mailbox#getUidValidity()
+	 */
+	public long getUidValidity() {
+		return uidValidity;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see java.lang.Object#equals(java.lang.Object)
+	 */
+	public boolean equals(Object obj) {
+		if (obj == this) {
+			return true;
+		}
+		if (obj instanceof MaildirMailbox) {
+			if (id == ((MaildirMailbox) obj).getMailboxId()) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	/* 
+	 * (non-Javadoc)
+	 * @see java.lang.Object#hashCode()
+	 */
+	@Override
+	public int hashCode() {
+	    final int PRIME = 31;
+        int result = 1;
+        result = PRIME * result + namespace.hashCode();
+        result = PRIME * result + user.hashCode();
+        result = PRIME * result + name.hashCode();
+        return result;
+	}
+	
+	/* 
+	 * (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+	    return namespace + ":" + user + ":" + name;
+	}
+
+}

Modified: james/imap/trunk/maildir/src/main/java/org/apache/james/imap/maildir/mail/model/MaildirMessage.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/maildir/src/main/java/org/apache/james/imap/maildir/mail/model/MaildirMessage.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/maildir/src/main/java/org/apache/james/imap/maildir/mail/model/MaildirMessage.java (original)
+++ james/imap/trunk/maildir/src/main/java/org/apache/james/imap/maildir/mail/model/MaildirMessage.java Mon Sep  6 17:19:17 2010
@@ -28,7 +28,6 @@ import java.util.List;
 import javax.mail.Flags;
 
 import org.apache.commons.lang.NotImplementedException;
-import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.mailbox.MailboxException;
 import org.apache.james.imap.maildir.MaildirMessageName;
 import org.apache.james.imap.store.mail.model.AbstractMessage;
@@ -152,7 +151,7 @@ public class MaildirMessage extends Abst
         try {
             this.rawFullContent = new ByteArrayInputStream(StreamUtils.toByteArray(message.getFullContent()));
         } catch (IOException e) {
-            throw new MailboxException(HumanReadableText.FAILURE_MAIL_PARSE,e);
+            throw new MailboxException("Parsing of message failed",e);
         }
        
         this.bodyStartOctet = (int) (message.getFullContentOctets() - message.getBodyOctets());

Modified: james/imap/trunk/maildir/src/main/java/org/apache/james/imap/maildir/user/MaildirSubscriptionMapper.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/maildir/src/main/java/org/apache/james/imap/maildir/user/MaildirSubscriptionMapper.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/maildir/src/main/java/org/apache/james/imap/maildir/user/MaildirSubscriptionMapper.java (original)
+++ james/imap/trunk/maildir/src/main/java/org/apache/james/imap/maildir/user/MaildirSubscriptionMapper.java Mon Sep  6 17:19:17 2010
@@ -30,8 +30,6 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
-import org.apache.james.imap.api.display.HumanReadableText;
-import org.apache.james.imap.mailbox.MailboxException;
 import org.apache.james.imap.mailbox.SubscriptionException;
 import org.apache.james.imap.maildir.user.model.MaildirSubscription;
 import org.apache.james.imap.store.transaction.NonTransactionalMapper;
@@ -60,7 +58,7 @@ public class MaildirSubscriptionMapper e
             try {
                 writeSubscriptions(new File(createFolderNameFromUser(subscription.getUser())), subscriptionNames);
             } catch (IOException e) {
-                throw new SubscriptionException(HumanReadableText.GENERIC_SUBSCRIPTION_FAILURE);
+                throw new SubscriptionException(e);
             }
         }
     }
@@ -88,7 +86,7 @@ public class MaildirSubscriptionMapper e
         try {
             subscriptionNames = readSubscriptions(userRoot);
         } catch (IOException e) {
-            throw new SubscriptionException(HumanReadableText.GENERIC_SUBSCRIPTION_FAILURE);
+            throw new SubscriptionException(e);
         }
         if (subscriptionNames.contains(mailbox))
             return new MaildirSubscription(user, mailbox);
@@ -107,7 +105,7 @@ public class MaildirSubscriptionMapper e
             try {
                 writeSubscriptions(new File(createFolderNameFromUser(subscription.getUser())), subscriptionNames);
             } catch (IOException e) {
-                throw new SubscriptionException(HumanReadableText.GENERIC_SUBSCRIPTION_FAILURE);
+                throw new SubscriptionException(e);
             }
         }
     }
@@ -141,7 +139,7 @@ public class MaildirSubscriptionMapper e
         try {
             subscriptionNames = readSubscriptions(userRoot);
         } catch (IOException e) {
-            throw new SubscriptionException(HumanReadableText.GENERIC_SUBSCRIPTION_FAILURE);
+            throw new SubscriptionException(e);
         }
         return subscriptionNames;
     }

Modified: james/imap/trunk/memory/src/main/java/org/apache/james/imap/inmemory/InMemoryMailboxManager.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/memory/src/main/java/org/apache/james/imap/inmemory/InMemoryMailboxManager.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/memory/src/main/java/org/apache/james/imap/inmemory/InMemoryMailboxManager.java (original)
+++ james/imap/trunk/memory/src/main/java/org/apache/james/imap/inmemory/InMemoryMailboxManager.java Mon Sep  6 17:19:17 2010
@@ -19,11 +19,10 @@
 
 package org.apache.james.imap.inmemory;
 
-import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.inmemory.mail.model.InMemoryMailbox;
 import org.apache.james.imap.mailbox.MailboxException;
+import org.apache.james.imap.mailbox.MailboxPath;
 import org.apache.james.imap.mailbox.MailboxSession;
-import org.apache.james.imap.mailbox.StorageException;
 import org.apache.james.imap.mailbox.util.MailboxEventDispatcher;
 import org.apache.james.imap.store.Authenticator;
 import org.apache.james.imap.store.MailboxSessionMapperFactory;
@@ -43,7 +42,7 @@ public class InMemoryMailboxManager exte
     }
 
     @Override
-    protected void doCreateMailbox(MailboxPath mailboxPath, MailboxSession session) throws StorageException {
+    protected void doCreateMailbox(MailboxPath mailboxPath, MailboxSession session) throws MailboxException {
         InMemoryMailbox mailbox = new InMemoryMailbox(randomId(), mailboxPath, randomUidValidity());
         try {
             mailboxSessionMapperFactory.getMailboxMapper(session).save(mailbox);

Modified: james/imap/trunk/memory/src/main/java/org/apache/james/imap/inmemory/mail/InMemoryMailboxMapper.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/memory/src/main/java/org/apache/james/imap/inmemory/mail/InMemoryMailboxMapper.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/memory/src/main/java/org/apache/james/imap/inmemory/mail/InMemoryMailboxMapper.java (original)
+++ james/imap/trunk/memory/src/main/java/org/apache/james/imap/inmemory/mail/InMemoryMailboxMapper.java Mon Sep  6 17:19:17 2010
@@ -23,10 +23,10 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
-import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.inmemory.mail.model.InMemoryMailbox;
+import org.apache.james.imap.mailbox.MailboxException;
 import org.apache.james.imap.mailbox.MailboxNotFoundException;
-import org.apache.james.imap.mailbox.StorageException;
+import org.apache.james.imap.mailbox.MailboxPath;
 import org.apache.james.imap.store.mail.MailboxMapper;
 import org.apache.james.imap.store.mail.model.Mailbox;
 import org.apache.james.imap.store.transaction.NonTransactionalMapper;
@@ -46,7 +46,7 @@ public class InMemoryMailboxMapper exten
      * (non-Javadoc)
      * @see org.apache.james.imap.store.mail.MailboxMapper#delete(org.apache.james.imap.store.mail.model.Mailbox)
      */
-    public void delete(Mailbox<Long> mailbox) throws StorageException {
+    public void delete(Mailbox<Long> mailbox) throws MailboxException {
         mailboxesById.remove(mailbox.getMailboxId());
     }
 
@@ -54,7 +54,7 @@ public class InMemoryMailboxMapper exten
      * (non-Javadoc)
      * @see org.apache.james.imap.store.mail.MailboxMapper#deleteAll()
      */
-    public void deleteAll() throws StorageException {
+    public void deleteAll() throws MailboxException {
         mailboxesById.clear();
     }
 
@@ -63,10 +63,10 @@ public class InMemoryMailboxMapper exten
      * (non-Javadoc)
      * @see org.apache.james.imap.store.mail.MailboxMapper#findMailboxById(java.lang.Object)
      */
-    public Mailbox<Long> findMailboxById(Long mailboxId) throws StorageException, MailboxNotFoundException {
+    public Mailbox<Long> findMailboxById(Long mailboxId) throws MailboxException, MailboxNotFoundException {
         Mailbox<Long> mailbox = mailboxesById.get(mailboxesById);
         if (mailbox == null) {
-            throw new MailboxNotFoundException(mailboxId);
+            throw new MailboxNotFoundException(String.valueOf(mailboxId));
         } else {
             return mailbox;
         }
@@ -76,7 +76,7 @@ public class InMemoryMailboxMapper exten
      * (non-Javadoc)
      * @see org.apache.james.imap.store.mail.MailboxMapper#findMailboxByName(java.lang.String)
      */
-    public synchronized Mailbox<Long> findMailboxByPath(MailboxPath path) throws StorageException, MailboxNotFoundException {
+    public synchronized Mailbox<Long> findMailboxByPath(MailboxPath path) throws MailboxException, MailboxNotFoundException {
         Mailbox<Long> result = null;
         for (final InMemoryMailbox mailbox:mailboxesById.values()) {
             MailboxPath mp = new MailboxPath(mailbox.getNamespace(), mailbox.getUser(), mailbox.getName());
@@ -96,7 +96,7 @@ public class InMemoryMailboxMapper exten
      * (non-Javadoc)
      * @see org.apache.james.imap.store.mail.MailboxMapper#findMailboxWithNameLike(java.lang.String)
      */
-    public List<Mailbox<Long>> findMailboxWithPathLike(MailboxPath path) throws StorageException {
+    public List<Mailbox<Long>> findMailboxWithPathLike(MailboxPath path) throws MailboxException {
         final String regex = path.getName().replace("%", ".*");
         List<Mailbox<Long>> results = new ArrayList<Mailbox<Long>>();
         for (final InMemoryMailbox mailbox:mailboxesById.values()) {
@@ -111,7 +111,7 @@ public class InMemoryMailboxMapper exten
      * (non-Javadoc)
      * @see org.apache.james.imap.store.mail.MailboxMapper#save(org.apache.james.imap.store.mail.model.Mailbox)
      */
-    public void save(Mailbox<Long> mailbox) throws StorageException {
+    public void save(Mailbox<Long> mailbox) throws MailboxException {
         mailboxesById.put(mailbox.getMailboxId(), (InMemoryMailbox) mailbox);
     }
 
@@ -126,7 +126,7 @@ public class InMemoryMailboxMapper exten
      * (non-Javadoc)
      * @see org.apache.james.imap.store.mail.MailboxMapper#hasChildren(org.apache.james.imap.store.mail.model.Mailbox)
      */
-    public boolean hasChildren(Mailbox<Long> mailbox) throws StorageException,
+    public boolean hasChildren(Mailbox<Long> mailbox) throws MailboxException,
             MailboxNotFoundException {
         String mailboxName = mailbox.getName() + delimiter;
         for (final InMemoryMailbox box:mailboxesById.values()) {

Modified: james/imap/trunk/memory/src/main/java/org/apache/james/imap/inmemory/mail/InMemoryMessageMapper.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/memory/src/main/java/org/apache/james/imap/inmemory/mail/InMemoryMessageMapper.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/memory/src/main/java/org/apache/james/imap/inmemory/mail/InMemoryMessageMapper.java (original)
+++ james/imap/trunk/memory/src/main/java/org/apache/james/imap/inmemory/mail/InMemoryMessageMapper.java Mon Sep  6 17:19:17 2010
@@ -1,3 +1,22 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
 package org.apache.james.imap.inmemory.mail;
 
 import java.util.ArrayList;
@@ -9,9 +28,9 @@ import java.util.concurrent.ConcurrentHa
 
 import org.apache.james.imap.inmemory.mail.model.InMemoryMailbox;
 import org.apache.james.imap.inmemory.mail.model.SimpleMailboxMembership;
+import org.apache.james.imap.mailbox.MailboxException;
 import org.apache.james.imap.mailbox.MessageRange;
 import org.apache.james.imap.mailbox.SearchQuery;
-import org.apache.james.imap.mailbox.StorageException;
 import org.apache.james.imap.store.MailboxMembershipComparator;
 import org.apache.james.imap.store.SearchQueryIterator;
 import org.apache.james.imap.store.mail.MessageMapper;
@@ -41,7 +60,7 @@ public class InMemoryMessageMapper exten
      * (non-Javadoc)
      * @see org.apache.james.imap.store.mail.MessageMapper#countMessagesInMailbox()
      */
-    public long countMessagesInMailbox(Mailbox<Long> mailbox) throws StorageException {
+    public long countMessagesInMailbox(Mailbox<Long> mailbox) throws MailboxException {
         return getMembershipByUidForMailbox(mailbox).size();
     }
 
@@ -49,7 +68,7 @@ public class InMemoryMessageMapper exten
      * (non-Javadoc)
      * @see org.apache.james.imap.store.mail.MessageMapper#countUnseenMessagesInMailbox()
      */
-    public long countUnseenMessagesInMailbox(Mailbox<Long> mailbox) throws StorageException {
+    public long countUnseenMessagesInMailbox(Mailbox<Long> mailbox) throws MailboxException {
         long count = 0;
         for(MailboxMembership<Long> member:getMembershipByUidForMailbox(mailbox).values()) {
             if (!member.isSeen()) {
@@ -63,7 +82,7 @@ public class InMemoryMessageMapper exten
      * (non-Javadoc)
      * @see org.apache.james.imap.store.mail.MessageMapper#delete(org.apache.james.imap.store.mail.model.MailboxMembership)
      */
-    public void delete(Mailbox<Long> mailbox, MailboxMembership<Long> message) throws StorageException {
+    public void delete(Mailbox<Long> mailbox, MailboxMembership<Long> message) throws MailboxException {
         getMembershipByUidForMailbox(mailbox).remove(message.getUid());
     }
 
@@ -72,7 +91,7 @@ public class InMemoryMessageMapper exten
      * @see org.apache.james.imap.store.mail.MessageMapper#findInMailbox(java.lang.Object, org.apache.james.imap.mailbox.MessageRange)
      */
     @SuppressWarnings("unchecked")
-    public List<MailboxMembership<Long>> findInMailbox(Mailbox<Long> mailbox, MessageRange set) throws StorageException {
+    public List<MailboxMembership<Long>> findInMailbox(Mailbox<Long> mailbox, MessageRange set) throws MailboxException {
         final List<MailboxMembership<Long>> results;
         final MessageRange.Type type = set.getType();
         switch (type) {
@@ -115,7 +134,7 @@ public class InMemoryMessageMapper exten
      * (non-Javadoc)
      * @see org.apache.james.imap.store.mail.MessageMapper#findMarkedForDeletionInMailbox(org.apache.james.imap.mailbox.MessageRange)
      */
-    public List<MailboxMembership<Long>> findMarkedForDeletionInMailbox(Mailbox<Long> mailbox, MessageRange set) throws StorageException {
+    public List<MailboxMembership<Long>> findMarkedForDeletionInMailbox(Mailbox<Long> mailbox, MessageRange set) throws MailboxException {
         final List<MailboxMembership<Long>> results = findInMailbox(mailbox, set);
         for(final Iterator<MailboxMembership<Long>> it=results.iterator();it.hasNext();) {
             if (!it.next().isDeleted()) {
@@ -129,7 +148,7 @@ public class InMemoryMessageMapper exten
      * (non-Javadoc)
      * @see org.apache.james.imap.store.mail.MessageMapper#findRecentMessagesInMailbox()
      */
-    public List<MailboxMembership<Long>> findRecentMessagesInMailbox(Mailbox<Long> mailbox,int limit) throws StorageException {
+    public List<MailboxMembership<Long>> findRecentMessagesInMailbox(Mailbox<Long> mailbox,int limit) throws MailboxException {
         final List<MailboxMembership<Long>> results = new ArrayList<MailboxMembership<Long>>();
         for(MailboxMembership<Long> member:getMembershipByUidForMailbox(mailbox).values()) {
             if (member.isRecent()) {
@@ -147,7 +166,7 @@ public class InMemoryMessageMapper exten
      * (non-Javadoc)
      * @see org.apache.james.imap.store.mail.MessageMapper#findFirstUnseenMessageUid(org.apache.james.imap.store.mail.model.Mailbox)
      */
-    public Long findFirstUnseenMessageUid(Mailbox<Long> mailbox) throws StorageException {
+    public Long findFirstUnseenMessageUid(Mailbox<Long> mailbox) throws MailboxException {
         List<MailboxMembership<Long>> memberships = new ArrayList<MailboxMembership<Long>>(getMembershipByUidForMailbox(mailbox).values());
         Collections.sort(memberships, MailboxMembershipComparator.INSTANCE);
         for (int i = 0;  i < memberships.size(); i++) {
@@ -163,7 +182,7 @@ public class InMemoryMessageMapper exten
      * (non-Javadoc)
      * @see org.apache.james.imap.store.mail.MessageMapper#save(org.apache.james.imap.store.mail.model.MailboxMembership)
      */
-    public long save(Mailbox<Long> mailbox, MailboxMembership<Long> message) throws StorageException {
+    public long save(Mailbox<Long> mailbox, MailboxMembership<Long> message) throws MailboxException {
         getMembershipByUidForMailbox(mailbox).put(message.getUid(), message);
         return message.getUid();
     }
@@ -173,7 +192,7 @@ public class InMemoryMessageMapper exten
      * (non-Javadoc)
      * @see org.apache.james.imap.store.mail.MessageMapper#searchMailbox(org.apache.james.imap.store.mail.model.Mailbox, org.apache.james.imap.mailbox.SearchQuery)
      */
-    public Iterator<Long> searchMailbox(Mailbox<Long> mailbox, SearchQuery query) throws StorageException {
+    public Iterator<Long> searchMailbox(Mailbox<Long> mailbox, SearchQuery query) throws MailboxException {
         List<MailboxMembership<?>> memberships = new ArrayList<MailboxMembership<?>>(getMembershipByUidForMailbox(mailbox).values());
         Collections.sort(memberships, MailboxMembershipComparator.INSTANCE);
 
@@ -196,7 +215,7 @@ public class InMemoryMessageMapper exten
      * (non-Javadoc)
      * @see org.apache.james.imap.store.mail.MessageMapper#copy(org.apache.james.imap.store.mail.model.Mailbox, org.apache.james.imap.store.mail.model.MailboxMembership)
      */
-    public long copy(Mailbox<Long> mailbox, MailboxMembership<Long> original) throws StorageException {
+    public long copy(Mailbox<Long> mailbox, MailboxMembership<Long> original) throws MailboxException {
         ((InMemoryMailbox) mailbox).consumeUid();
         SimpleMailboxMembership membership = new SimpleMailboxMembership(mailbox.getMailboxId(), mailbox.getLastUid(), (SimpleMailboxMembership) original);
         return save(mailbox, membership);

Modified: james/imap/trunk/memory/src/main/java/org/apache/james/imap/inmemory/mail/model/InMemoryMailbox.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/memory/src/main/java/org/apache/james/imap/inmemory/mail/model/InMemoryMailbox.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/memory/src/main/java/org/apache/james/imap/inmemory/mail/model/InMemoryMailbox.java (original)
+++ james/imap/trunk/memory/src/main/java/org/apache/james/imap/inmemory/mail/model/InMemoryMailbox.java Mon Sep  6 17:19:17 2010
@@ -21,7 +21,7 @@ package org.apache.james.imap.inmemory.m
 
 import java.util.concurrent.atomic.AtomicLong;
 
-import org.apache.james.imap.api.MailboxPath;
+import org.apache.james.imap.mailbox.MailboxPath;
 import org.apache.james.imap.store.mail.model.Mailbox;
 
 /**

Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java Mon Sep  6 17:19:17 2010
@@ -24,11 +24,9 @@ import java.util.Iterator;
 import javax.mail.Flags;
 import javax.mail.MessagingException;
 
-import org.apache.commons.logging.Log;
 import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapConstants;
 import org.apache.james.imap.api.ImapMessage;
-import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.request.ImapRequest;
 import org.apache.james.imap.api.message.response.ImapResponseMessage;
@@ -37,12 +35,11 @@ import org.apache.james.imap.api.message
 import org.apache.james.imap.api.process.ImapProcessor;
 import org.apache.james.imap.api.process.ImapSession;
 import org.apache.james.imap.api.process.SelectedMailbox;
+import org.apache.james.imap.mailbox.MailboxPath;
 import org.apache.james.imap.mailbox.MessageManager;
 import org.apache.james.imap.mailbox.MailboxConstants;
 import org.apache.james.imap.mailbox.MailboxException;
-import org.apache.james.imap.mailbox.MailboxExistsException;
 import org.apache.james.imap.mailbox.MailboxManager;
-import org.apache.james.imap.mailbox.MailboxNotFoundException;
 import org.apache.james.imap.mailbox.MailboxSession;
 import org.apache.james.imap.mailbox.MessageRange;
 import org.apache.james.imap.mailbox.MessageResult;
@@ -81,38 +78,7 @@ abstract public class AbstractMailboxPro
         doProcess(message, command, tag, responder, session);
     }
 
-    protected void no(final ImapCommand command, final String tag,
-            final Responder responder, final MessagingException e, ImapSession session) {
-        final Log logger = session.getLog();
-        final ImapResponseMessage response;
-        if (e instanceof MailboxExistsException) {
-            response = factory.taggedNo(tag, command,
-                    HumanReadableText.FAILURE_MAILBOX_EXISTS);
-        } else if (e instanceof MailboxNotFoundException) {
-            response = factory.taggedNo(tag, command,
-                    HumanReadableText.FAILURE_NO_SUCH_MAILBOX);
-        } else {
-            if (logger != null) {
-                logger.info(e.getMessage());
-                logger.debug("Processing failed:", e);
-            }
-            final HumanReadableText key;
-            if (e instanceof MailboxException) {
-                final MailboxException mailboxException = (MailboxException) e;
-                final HumanReadableText exceptionKey = mailboxException.getKey();
-                if (exceptionKey == null) {
-                    key = HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING;
-                } else {
-                    key = exceptionKey;
-                }
-            } else {
-                key = HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING;
-            }
-            response = factory.taggedNo(tag, command, key);
-        }
-        responder.respond(response);
-    }
-
+   
     final void doProcess(final ImapRequest message, final ImapCommand command,
             final String tag, Responder responder, ImapSession session) {
         if (!command.validForState(session.getState())) {

Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java Mon Sep  6 17:19:17 2010
@@ -25,7 +25,6 @@ import java.util.List;
 import javax.mail.Flags;
 
 import org.apache.james.imap.api.ImapCommand;
-import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.request.ImapRequest;
 import org.apache.james.imap.api.message.response.StatusResponse;
@@ -34,6 +33,7 @@ import org.apache.james.imap.api.message
 import org.apache.james.imap.api.process.ImapProcessor;
 import org.apache.james.imap.api.process.ImapSession;
 import org.apache.james.imap.api.process.SelectedMailbox;
+import org.apache.james.imap.mailbox.MailboxPath;
 import org.apache.james.imap.mailbox.MessageManager;
 import org.apache.james.imap.mailbox.MailboxException;
 import org.apache.james.imap.mailbox.MailboxManager;
@@ -84,7 +84,7 @@ abstract class AbstractSelectionProcesso
             responder.respond(statusResponseFactory.taggedNo(tag, command,
                     HumanReadableText.FAILURE_NO_SUCH_MAILBOX));
         } catch (MailboxException e) {
-            no(command, tag, responder, e, session);
+            no(command, tag, responder, HumanReadableText.SELECT);
         }
     }
 

Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AppendProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AppendProcessor.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AppendProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AppendProcessor.java Mon Sep  6 17:19:17 2010
@@ -28,7 +28,6 @@ import javax.mail.Flags;
 import org.apache.commons.logging.Log;
 import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapMessage;
-import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.request.ImapRequest;
 import org.apache.james.imap.api.message.response.StatusResponse;
@@ -36,12 +35,12 @@ import org.apache.james.imap.api.message
 import org.apache.james.imap.api.process.ImapProcessor;
 import org.apache.james.imap.api.process.ImapSession;
 import org.apache.james.imap.api.process.SelectedMailbox;
+import org.apache.james.imap.mailbox.MailboxPath;
 import org.apache.james.imap.mailbox.MessageManager;
 import org.apache.james.imap.mailbox.MailboxException;
 import org.apache.james.imap.mailbox.MailboxManager;
 import org.apache.james.imap.mailbox.MailboxNotFoundException;
 import org.apache.james.imap.mailbox.MailboxSession;
-import org.apache.james.imap.mailbox.StorageException;
 import org.apache.james.imap.message.request.AppendRequest;
 import org.apache.james.imap.processor.base.ImapSessionUtils;
 
@@ -87,7 +86,7 @@ public class AppendProcessor extends Abs
             cosume(messageIn);
             
 //          Some other issue
-            no(command, tag, responder, e, session);
+            no(command, tag, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
             
         }
 
@@ -144,11 +143,12 @@ public class AppendProcessor extends Abs
 //          Indicates that the mailbox does not exist
 //          So TRY CREATE
             tryCreate(session, tag, command, responder, e);
-        } catch (StorageException e) {
+        /*} catch (StorageException e) {
             taggedBad(command, tag, responder, e.getKey());
+        */   
         } catch (MailboxException e) {
 //          Some other issue
-            no(command, tag, responder, e, session);
+            no(command, tag, responder, HumanReadableText.SAVE_FAILED);
         }
     }
     

Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CloseProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CloseProcessor.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CloseProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CloseProcessor.java Mon Sep  6 17:19:17 2010
@@ -21,6 +21,7 @@ package org.apache.james.imap.processor;
 
 import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapMessage;
+import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.request.ImapRequest;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
 import org.apache.james.imap.api.process.ImapProcessor;
@@ -50,20 +51,20 @@ public class CloseProcessor extends Abst
             MessageManager mailbox = getSelectedMailbox(session);
             final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
             if (mailbox.isWriteable(mailboxSession)) {
-                
 
-                    mailbox.expunge(MessageRange.all(), 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);
+                mailbox.expunge(MessageRange.all(), 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 (MailboxException e) {
-            no(command, tag, responder, e, session);
+            no(command, tag, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
     }
 }

Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CopyProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CopyProcessor.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CopyProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CopyProcessor.java Mon Sep  6 17:19:17 2010
@@ -21,7 +21,6 @@ package org.apache.james.imap.processor;
 
 import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapMessage;
-import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.IdRange;
 import org.apache.james.imap.api.message.request.ImapRequest;
@@ -32,6 +31,7 @@ import org.apache.james.imap.api.process
 import org.apache.james.imap.api.process.SelectedMailbox;
 import org.apache.james.imap.mailbox.MailboxException;
 import org.apache.james.imap.mailbox.MailboxManager;
+import org.apache.james.imap.mailbox.MailboxPath;
 import org.apache.james.imap.mailbox.MailboxSession;
 import org.apache.james.imap.mailbox.MessageRange;
 import org.apache.james.imap.message.request.CopyRequest;
@@ -85,7 +85,7 @@ public class CopyProcessor extends Abstr
                 okComplete(command, tag, responder);
             }
         } catch (MailboxException e) {
-            no(command, tag, responder, e, session);
+            no(command, tag, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
     }
 }

Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CreateProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CreateProcessor.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CreateProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CreateProcessor.java Mon Sep  6 17:19:17 2010
@@ -21,13 +21,15 @@ package org.apache.james.imap.processor;
 
 import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapMessage;
-import org.apache.james.imap.api.MailboxPath;
+import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.request.ImapRequest;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
 import org.apache.james.imap.api.process.ImapProcessor;
 import org.apache.james.imap.api.process.ImapSession;
 import org.apache.james.imap.mailbox.MailboxException;
+import org.apache.james.imap.mailbox.MailboxExistsException;
 import org.apache.james.imap.mailbox.MailboxManager;
+import org.apache.james.imap.mailbox.MailboxPath;
 import org.apache.james.imap.message.request.CreateRequest;
 import org.apache.james.imap.processor.base.ImapSessionUtils;
 
@@ -52,8 +54,10 @@ public class CreateProcessor extends Abs
             mailboxManager.createMailbox(mailboxPath, ImapSessionUtils.getMailboxSession(session));
             unsolicitedResponses(session, responder, false);
             okComplete(command, tag, responder);
+        } catch (MailboxExistsException e) {
+            no(command, tag, responder, HumanReadableText.MAILBOX_EXISTS);
         } catch (MailboxException e) {
-            no(command, tag, responder, e, session);
+            no(command, tag, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
     }
 }

Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/DeleteProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/DeleteProcessor.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/DeleteProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/DeleteProcessor.java Mon Sep  6 17:19:17 2010
@@ -21,7 +21,7 @@ package org.apache.james.imap.processor;
 
 import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapMessage;
-import org.apache.james.imap.api.MailboxPath;
+import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.request.ImapRequest;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
 import org.apache.james.imap.api.process.ImapProcessor;
@@ -29,6 +29,8 @@ import org.apache.james.imap.api.process
 import org.apache.james.imap.api.process.SelectedMailbox;
 import org.apache.james.imap.mailbox.MailboxException;
 import org.apache.james.imap.mailbox.MailboxManager;
+import org.apache.james.imap.mailbox.MailboxNotFoundException;
+import org.apache.james.imap.mailbox.MailboxPath;
 import org.apache.james.imap.message.request.DeleteRequest;
 import org.apache.james.imap.processor.base.ImapSessionUtils;
 
@@ -57,8 +59,11 @@ public class DeleteProcessor extends Abs
             mailboxManager.deleteMailbox(mailboxPath, ImapSessionUtils.getMailboxSession(session));
             unsolicitedResponses(session, responder, false);
             okComplete(command, tag, responder);
+        } catch (MailboxNotFoundException e) {
+            no(command, tag, responder, HumanReadableText.FAILURE_NO_SUCH_MAILBOX);
+
         } catch (MailboxException e) {
-            no(command, tag, responder, e, session);
+            no(command, tag, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
     }
 }

Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/ExpungeProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/ExpungeProcessor.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/ExpungeProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/ExpungeProcessor.java Mon Sep  6 17:19:17 2010
@@ -71,7 +71,7 @@ public class ExpungeProcessor extends Ab
                 okComplete(command, tag, responder);
             }
         } catch (MailboxException e) {
-            no(command, tag, responder, e, session);
+            no(command, tag, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
     }
 }

Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/LSubProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/LSubProcessor.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/LSubProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/LSubProcessor.java Mon Sep  6 17:19:17 2010
@@ -25,7 +25,6 @@ import java.util.Collection;
 import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapConstants;
 import org.apache.james.imap.api.ImapMessage;
-import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.request.ImapRequest;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
@@ -34,6 +33,7 @@ import org.apache.james.imap.api.process
 import org.apache.james.imap.mailbox.MailboxConstants;
 import org.apache.james.imap.mailbox.MailboxException;
 import org.apache.james.imap.mailbox.MailboxManager;
+import org.apache.james.imap.mailbox.MailboxPath;
 import org.apache.james.imap.mailbox.MailboxQuery;
 import org.apache.james.imap.mailbox.MailboxSession;
 import org.apache.james.imap.mailbox.SubscriptionException;
@@ -133,14 +133,7 @@ public class LSubProcessor extends Abstr
 
         } catch (SubscriptionException e) {
             session.getLog().debug("Subscription failed", e);
-            final HumanReadableText exceptionKey = e.getKey();
-            final HumanReadableText displayTextKey;
-            if (exceptionKey == null) {
-                displayTextKey = HumanReadableText.GENERIC_LSUB_FAILURE;
-            } else {
-                displayTextKey = exceptionKey;
-            }
-            no(command, tag, responder, displayTextKey);
+            no(command, tag, responder, HumanReadableText.GENERIC_LSUB_FAILURE);
         } catch (MailboxException e) {
             session.getLog().debug("Subscription failed", e);
             final HumanReadableText displayTextKey = HumanReadableText.GENERIC_LSUB_FAILURE;

Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/ListProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/ListProcessor.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/ListProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/ListProcessor.java Mon Sep  6 17:19:17 2010
@@ -25,7 +25,7 @@ import java.util.List;
 import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapConstants;
 import org.apache.james.imap.api.ImapMessage;
-import org.apache.james.imap.api.MailboxPath;
+import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.request.ImapRequest;
 import org.apache.james.imap.api.message.response.ImapResponseMessage;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
@@ -35,6 +35,7 @@ import org.apache.james.imap.mailbox.Mai
 import org.apache.james.imap.mailbox.MailboxException;
 import org.apache.james.imap.mailbox.MailboxManager;
 import org.apache.james.imap.mailbox.MailboxMetaData;
+import org.apache.james.imap.mailbox.MailboxPath;
 import org.apache.james.imap.mailbox.MailboxQuery;
 import org.apache.james.imap.mailbox.MailboxMetaData.Children;
 import org.apache.james.imap.mailbox.util.SimpleMailboxMetaData;
@@ -154,7 +155,7 @@ public class ListProcessor extends Abstr
 
             okComplete(command, tag, responder);
         } catch (MailboxException e) {
-            no(command, tag, responder, e, session);
+            no(command, tag, responder, HumanReadableText.SEARCH_FAILED);
         }
     }
 

Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/LoginProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/LoginProcessor.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/LoginProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/LoginProcessor.java Mon Sep  6 17:19:17 2010
@@ -21,7 +21,6 @@ package org.apache.james.imap.processor;
 
 import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapMessage;
-import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.request.ImapRequest;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
@@ -31,6 +30,7 @@ import org.apache.james.imap.mailbox.Bad
 import org.apache.james.imap.mailbox.MailboxException;
 import org.apache.james.imap.mailbox.MailboxExistsException;
 import org.apache.james.imap.mailbox.MailboxManager;
+import org.apache.james.imap.mailbox.MailboxPath;
 import org.apache.james.imap.mailbox.MailboxSession;
 import org.apache.james.imap.message.request.LoginRequest;
 import org.apache.james.imap.processor.base.ImapSessionUtils;
@@ -103,7 +103,7 @@ public class LoginProcessor extends Abst
             }
         } catch (MailboxException e) {
             session.getLog().debug("Login failed", e);
-            no(command, tag, responder, e.getKey());
+            no(command, tag, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
     }
 }

Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/LogoutProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/LogoutProcessor.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/LogoutProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/LogoutProcessor.java Mon Sep  6 17:19:17 2010
@@ -21,6 +21,7 @@ package org.apache.james.imap.processor;
 
 import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapMessage;
+import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.request.ImapRequest;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
 import org.apache.james.imap.api.process.ImapProcessor;
@@ -51,7 +52,7 @@ public class LogoutProcessor extends Abs
             bye(responder);
             okComplete(command, tag, responder);
         } catch (MailboxException e) {
-            no(command, tag, responder, e, session);
+            no(command, tag, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
     }
 }

Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/RenameProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/RenameProcessor.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/RenameProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/RenameProcessor.java Mon Sep  6 17:19:17 2010
@@ -21,7 +21,6 @@ package org.apache.james.imap.processor;
 
 import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapMessage;
-import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.request.ImapRequest;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
@@ -31,6 +30,7 @@ import org.apache.james.imap.mailbox.Mai
 import org.apache.james.imap.mailbox.MailboxExistsException;
 import org.apache.james.imap.mailbox.MailboxManager;
 import org.apache.james.imap.mailbox.MailboxNotFoundException;
+import org.apache.james.imap.mailbox.MailboxPath;
 import org.apache.james.imap.message.request.RenameRequest;
 import org.apache.james.imap.processor.base.ImapSessionUtils;
 
@@ -59,9 +59,9 @@ public class RenameProcessor extends Abs
         } catch (MailboxExistsException e) {
             no(command, tag, responder, HumanReadableText.FAILURE_MAILBOX_EXISTS);
         } catch (MailboxNotFoundException e) {
-            no(command, tag, responder, HumanReadableText.FAILURE_NO_SUCH_MAILBOX);
+            no(command, tag, responder, HumanReadableText.MAILBOX_NOT_FOUND);
         } catch (MailboxException e) {
-            no(command, tag, responder, e, session);
+            no(command, tag, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
     }
 }

Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/SearchProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/SearchProcessor.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/SearchProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/SearchProcessor.java Mon Sep  6 17:19:17 2010
@@ -30,6 +30,7 @@ import javax.mail.Flags.Flag;
 import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapConstants;
 import org.apache.james.imap.api.ImapMessage;
+import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.IdRange;
 import org.apache.james.imap.api.message.request.DayMonthYear;
 import org.apache.james.imap.api.message.request.ImapRequest;
@@ -77,7 +78,7 @@ public class SearchProcessor extends Abs
             unsolicitedResponses(session, responder, omitExpunged, useUids);
             okComplete(command, tag, responder);
         } catch (MailboxException e) {
-            no(command, tag, responder, e, session);
+            no(command, tag, responder, HumanReadableText.SEARCH_FAILED);
         }
     }
 



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