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 [3/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/processor/src/main/java/org/apache/james/imap/processor/StatusProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/StatusProcessor.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/StatusProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/StatusProcessor.java Mon Sep  6 17:19:17 2010
@@ -22,12 +22,13 @@ package org.apache.james.imap.processor;
 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.StatusDataItems;
 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.MailboxPath;
 import org.apache.james.imap.mailbox.MessageManager;
 import org.apache.james.imap.mailbox.MailboxException;
 import org.apache.james.imap.mailbox.MailboxManager;
@@ -85,7 +86,7 @@ public class StatusProcessor extends Abs
             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/StoreProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/StoreProcessor.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/StoreProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/StoreProcessor.java Mon Sep  6 17:19:17 2010
@@ -25,6 +25,7 @@ import javax.mail.Flags;
 
 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.IdRange;
 import org.apache.james.imap.api.message.request.ImapRequest;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
@@ -116,7 +117,7 @@ public class StoreProcessor extends Abst
             unsolicitedResponses(session, responder, omitExpunged, useUids);
             okComplete(command, tag, responder);
         } catch (MailboxException e) {
-            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/SubscribeProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/SubscribeProcessor.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/SubscribeProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/SubscribeProcessor.java Mon Sep  6 17:19:17 2010
@@ -57,15 +57,7 @@ public class SubscribeProcessor extends 
         } catch (SubscriptionException e) {
             session.getLog().debug("Subscription failed", e);
             unsolicitedResponses(session, responder, false);
-
-            final HumanReadableText exceptionKey = e.getKey();
-            final HumanReadableText displayTextKey;
-            if (exceptionKey == null) {
-                displayTextKey = HumanReadableText.GENERIC_SUBSCRIPTION_FAILURE;
-            } else {
-                displayTextKey = exceptionKey;
-            }
-            no(command, tag, responder, displayTextKey);
+            no(command, tag, responder,  HumanReadableText.GENERIC_SUBSCRIPTION_FAILURE);
         }        
     }
 

Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/UnsubscribeProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/UnsubscribeProcessor.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/UnsubscribeProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/UnsubscribeProcessor.java Mon Sep  6 17:19:17 2010
@@ -59,14 +59,7 @@ public class UnsubscribeProcessor extend
             session.getLog().debug("Subscription failed", e);
             unsolicitedResponses(session, responder, false);
 
-            final HumanReadableText exceptionKey = e.getKey();
-            final HumanReadableText displayTextKey;
-            if (exceptionKey == null) {
-                displayTextKey = HumanReadableText.GENERIC_UNSUBSCRIPTION_FAILURE;
-            } else {
-                displayTextKey = exceptionKey;
-            }
-            no(command, tag, responder, displayTextKey);
+            no(command, tag, responder,  HumanReadableText.GENERIC_SUBSCRIPTION_FAILURE);
         }        
     }
 

Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/base/MailboxEventAnalyser.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/base/MailboxEventAnalyser.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/base/MailboxEventAnalyser.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/base/MailboxEventAnalyser.java Mon Sep  6 17:19:17 2010
@@ -27,8 +27,8 @@ import java.util.TreeSet;
 
 import javax.mail.Flags;
 
-import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.mailbox.MailboxListener;
+import org.apache.james.imap.mailbox.MailboxPath;
 
 /**
  * {@link MailboxListener} implementation which will listen for {@link Event} notifications and 

Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/base/SelectedMailboxImpl.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/base/SelectedMailboxImpl.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/base/SelectedMailboxImpl.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/base/SelectedMailboxImpl.java Mon Sep  6 17:19:17 2010
@@ -25,10 +25,10 @@ import java.util.Iterator;
 import java.util.Set;
 import java.util.TreeSet;
 
-import org.apache.james.imap.api.MailboxPath;
 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;
 
 /**

Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java Mon Sep  6 17:19:17 2010
@@ -113,7 +113,7 @@ public class FetchProcessor extends Abst
             no(command, tag, responder,
                     HumanReadableText.UNSUPPORTED_SEARCH_CRITERIA);
         } catch (MessagingException e) {
-            no(command, tag, responder, e, session);
+            no(command, tag, responder, HumanReadableText.SEARCH_FAILED);
         } catch (ParseException e) {
             no(command, tag, responder, HumanReadableText.FAILURE_MAIL_PARSE);
         }

Modified: james/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/ListProcessorTest.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/ListProcessorTest.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/ListProcessorTest.java (original)
+++ james/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/ListProcessorTest.java Mon Sep  6 17:19:17 2010
@@ -20,12 +20,12 @@
 package org.apache.james.imap.processor;
 
 import org.apache.james.imap.api.ImapCommand;
-import org.apache.james.imap.api.MailboxPath;
 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.MailboxManager;
 import org.apache.james.imap.mailbox.MailboxMetaData;
+import org.apache.james.imap.mailbox.MailboxPath;
 import org.apache.james.imap.message.response.ListResponse;
 import org.jmock.Expectations;
 import org.jmock.Mockery;

Modified: james/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/SearchProcessorTest.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/SearchProcessorTest.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/SearchProcessorTest.java (original)
+++ james/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/SearchProcessorTest.java Mon Sep  6 17:19:17 2010
@@ -27,7 +27,6 @@ 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.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.DayMonthYear;
@@ -37,6 +36,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.MailboxManager;
 import org.apache.james.imap.mailbox.MailboxSession;

Modified: james/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/base/FakeMailboxListenerAdded.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/base/FakeMailboxListenerAdded.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/base/FakeMailboxListenerAdded.java (original)
+++ james/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/base/FakeMailboxListenerAdded.java Mon Sep  6 17:19:17 2010
@@ -19,8 +19,8 @@
 
 package org.apache.james.imap.processor.base;
 
-import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.mailbox.MailboxListener;
+import org.apache.james.imap.mailbox.MailboxPath;
 
 public class FakeMailboxListenerAdded extends MailboxListener.Added {
 

Modified: james/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/base/FakeMailboxListenerFlagsUpdate.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/base/FakeMailboxListenerFlagsUpdate.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/base/FakeMailboxListenerFlagsUpdate.java (original)
+++ james/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/base/FakeMailboxListenerFlagsUpdate.java Mon Sep  6 17:19:17 2010
@@ -26,7 +26,7 @@ import java.util.List;
 import javax.mail.Flags;
 import javax.mail.Flags.Flag;
 
-import org.apache.james.imap.api.MailboxPath;
+import org.apache.james.imap.mailbox.MailboxPath;
 import org.apache.james.imap.mailbox.MailboxListener.FlagsUpdated;
 
 public class FakeMailboxListenerFlagsUpdate extends FlagsUpdated {

Modified: james/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/base/MailboxEventAnalyserTest.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/base/MailboxEventAnalyserTest.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/base/MailboxEventAnalyserTest.java (original)
+++ james/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/base/MailboxEventAnalyserTest.java Mon Sep  6 17:19:17 2010
@@ -28,8 +28,8 @@ import java.util.Iterator;
 
 import javax.mail.Flags;
 
-import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.mailbox.MailboxListener;
+import org.apache.james.imap.mailbox.MailboxPath;
 import org.junit.Before;
 import org.junit.Test;
 

Modified: james/imap/trunk/store/pom.xml
URL: http://svn.apache.org/viewvc/james/imap/trunk/store/pom.xml?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/store/pom.xml (original)
+++ james/imap/trunk/store/pom.xml Mon Sep  6 17:19:17 2010
@@ -35,10 +35,6 @@
     </dependency>
     <dependency>
       <groupId>org.apache.james</groupId>
-      <artifactId>apache-james-imap-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.james</groupId>
       <artifactId>apache-james-imap-mailbox</artifactId>
     </dependency>
 

Modified: james/imap/trunk/store/src/main/java/org/apache/james/imap/store/DelegatingMailboxListener.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/store/src/main/java/org/apache/james/imap/store/DelegatingMailboxListener.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/store/src/main/java/org/apache/james/imap/store/DelegatingMailboxListener.java (original)
+++ james/imap/trunk/store/src/main/java/org/apache/james/imap/store/DelegatingMailboxListener.java Mon Sep  6 17:19:17 2010
@@ -24,8 +24,8 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.mailbox.MailboxListener;
+import org.apache.james.imap.mailbox.MailboxPath;
 
 /**
  * Receive a {@link Event} and delegate it to an other {@link MailboxListener} depending on the registered name

Modified: james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MailboxPathLock.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MailboxPathLock.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MailboxPathLock.java (original)
+++ james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MailboxPathLock.java Mon Sep  6 17:19:17 2010
@@ -1,76 +1,76 @@
-/****************************************************************
- * 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.store;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-import org.apache.james.imap.api.MailboxPath;
-
-/**
- * 
- * Helper class which helps to synchronize the access the 
- * same MailboxPath. This is done using one {@link ReentrantLock}
- * per {@link MailboxPath}.
- * 
- * Its very important to call the {@link #unlock(MailboxPath)} method
- * in a finally block to not risk a dead lock
- *
- */
-public final class MailboxPathLock {
-
-    private final Map<MailboxPath, ReentrantLock> paths = new HashMap<MailboxPath, ReentrantLock>();
-    
-    /**
-     * Obtain a {@link Lock} for the given path. It will block if the lock for the {@link MailboxPath} is
-     * already held by some other thread 
-     * 
-     * @param path
-     */
-    public void lock(MailboxPath path) {
-        ReentrantLock lock;
-        synchronized (paths) {
-            lock = paths.get(path);
-
-            if (lock == null) {
-                lock = new ReentrantLock();
-                paths.put(path, lock);
-            }
-        }
-        lock.lock();
-    }
-    
-    /**
-     * Unlock the previous obtained {@link Lock} for the given path
-     * 
-     * @param path
-     */
-    public void unlock(MailboxPath path) {
-        ReentrantLock lock;
-        synchronized (paths) {
-            lock = paths.remove(path);
-        }
-        if (lock != null) {
-            lock.unlock();
-        }
-    }
-}
+/****************************************************************
+ * 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.store;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+import org.apache.james.imap.mailbox.MailboxPath;
+
+/**
+ * 
+ * Helper class which helps to synchronize the access the 
+ * same MailboxPath. This is done using one {@link ReentrantLock}
+ * per {@link MailboxPath}.
+ * 
+ * Its very important to call the {@link #unlock(MailboxPath)} method
+ * in a finally block to not risk a dead lock
+ *
+ */
+public final class MailboxPathLock {
+
+    private final Map<MailboxPath, ReentrantLock> paths = new HashMap<MailboxPath, ReentrantLock>();
+    
+    /**
+     * Obtain a {@link Lock} for the given path. It will block if the lock for the {@link MailboxPath} is
+     * already held by some other thread 
+     * 
+     * @param path
+     */
+    public void lock(MailboxPath path) {
+        ReentrantLock lock;
+        synchronized (paths) {
+            lock = paths.get(path);
+
+            if (lock == null) {
+                lock = new ReentrantLock();
+                paths.put(path, lock);
+            }
+        }
+        lock.lock();
+    }
+    
+    /**
+     * Unlock the previous obtained {@link Lock} for the given path
+     * 
+     * @param path
+     */
+    public void unlock(MailboxPath path) {
+        ReentrantLock lock;
+        synchronized (paths) {
+            lock = paths.remove(path);
+        }
+        if (lock != null) {
+            lock.unlock();
+        }
+    }
+}

Modified: james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MapperStoreMessageManager.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MapperStoreMessageManager.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MapperStoreMessageManager.java (original)
+++ james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MapperStoreMessageManager.java Mon Sep  6 17:19:17 2010
@@ -28,7 +28,6 @@ import java.util.TreeSet;
 import javax.mail.Flags;
 import javax.mail.MessagingException;
 
-import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.mailbox.MailboxException;
 import org.apache.james.imap.mailbox.MailboxSession;
 import org.apache.james.imap.mailbox.MessageRange;
@@ -219,7 +218,7 @@ public abstract class MapperStoreMessage
             }
             return copiedRows.iterator();
         } catch (MessagingException e) {
-            throw new MailboxException(HumanReadableText.FAILURE_MAIL_PARSE, e);
+            throw new MailboxException("Unable to parse message", e);
         }
     }
     
@@ -235,7 +234,7 @@ public abstract class MapperStoreMessage
             return to.copy(originalRows, session);
 
         } catch (MessagingException e) {
-            throw new MailboxException(HumanReadableText.FAILURE_MAIL_PARSE, e);
+            throw new MailboxException("Unable to parse message", e);
         }
     }
 

Modified: james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MessageSearches.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MessageSearches.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MessageSearches.java (original)
+++ james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MessageSearches.java Mon Sep  6 17:19:17 2010
@@ -34,7 +34,6 @@ import javax.mail.Flags;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.mailbox.MailboxException;
 import org.apache.james.imap.mailbox.SearchQuery;
 import org.apache.james.imap.mailbox.UnsupportedSearchException;
@@ -145,9 +144,9 @@ public class MessageSearches {
                     throw new UnsupportedSearchException();
             }
         } catch (IOException e) {
-            throw new MailboxException(HumanReadableText.FAILURE_MAIL_PARSE, e);
+            throw new MailboxException("Unable to parse message", e);
         } catch (MimeException e) {
-            throw new MailboxException(HumanReadableText.FAILURE_MAIL_PARSE, e);
+            throw new MailboxException("Unable to parse message", e);
         }
     }
 

Modified: james/imap/trunk/store/src/main/java/org/apache/james/imap/store/ResultUtils.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/store/src/main/java/org/apache/james/imap/store/ResultUtils.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/store/src/main/java/org/apache/james/imap/store/ResultUtils.java (original)
+++ james/imap/trunk/store/src/main/java/org/apache/james/imap/store/ResultUtils.java Mon Sep  6 17:19:17 2010
@@ -31,7 +31,6 @@ import java.util.List;
 
 import javax.swing.text.Document;
 
-import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.mailbox.Content;
 import org.apache.james.imap.mailbox.MailboxException;
 import org.apache.james.imap.mailbox.MessageResult;
@@ -148,9 +147,9 @@ public class ResultUtils {
 
                 addPartContent(fetchGroup, message, messageResult);
             } catch (IOException e) {
-                throw new MailboxException(HumanReadableText.FAILURE_MAIL_PARSE, e);
+                throw new MailboxException("Unable to parse message", e);
             } catch (MimeException e) {
-                throw new MailboxException(HumanReadableText.FAILURE_MAIL_PARSE, e);
+                throw new MailboxException("Unable to parse message", e);
             }
         }
         return messageResult;

Modified: james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailboxManager.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailboxManager.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailboxManager.java (original)
+++ james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailboxManager.java Mon Sep  6 17:19:17 2010
@@ -29,8 +29,6 @@ import javax.mail.Flags;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.james.imap.api.ImapConstants;
-import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.mailbox.BadCredentialsException;
 import org.apache.james.imap.mailbox.MailboxConstants;
 import org.apache.james.imap.mailbox.MailboxException;
@@ -39,6 +37,7 @@ import org.apache.james.imap.mailbox.Mai
 import org.apache.james.imap.mailbox.MailboxManager;
 import org.apache.james.imap.mailbox.MailboxMetaData;
 import org.apache.james.imap.mailbox.MailboxNotFoundException;
+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.MessageRange;
@@ -293,7 +292,10 @@ public abstract class StoreMailboxManage
                         final String subNewName = to.getName() + subOriginalName.substring(from.getName().length());
                         final MailboxPath fromPath = new MailboxPath(children, subOriginalName);
                         final MailboxPath toPath = new MailboxPath(children, subNewName);
-                        if (sub.getName().equalsIgnoreCase(ImapConstants.INBOX_NAME) == false) {
+                        
+                        
+                        // TODO: Move to processor
+                        if (sub.getName().equalsIgnoreCase("INBOX") == false) {
                            
                             sub.setName(subNewName);
                             mapper.save(sub);

Modified: james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailboxPath.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailboxPath.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailboxPath.java (original)
+++ james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailboxPath.java Mon Sep  6 17:19:17 2010
@@ -19,7 +19,7 @@
 
 package org.apache.james.imap.store;
 
-import org.apache.james.imap.api.MailboxPath;
+import org.apache.james.imap.mailbox.MailboxPath;
 import org.apache.james.imap.store.mail.model.Mailbox;
 
 public class StoreMailboxPath<Id> extends MailboxPath {

Modified: james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMessageManager.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMessageManager.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMessageManager.java (original)
+++ james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMessageManager.java Mon Sep  6 17:19:17 2010
@@ -36,7 +36,6 @@ import javax.mail.Flags;
 import javax.mail.MessagingException;
 import javax.mail.util.SharedFileInputStream;
 
-import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.mailbox.MailboxException;
 import org.apache.james.imap.mailbox.MailboxListener;
 import org.apache.james.imap.mailbox.MailboxNotFoundException;
@@ -259,14 +258,11 @@ public abstract class StoreMessageManage
             dispatcher.added(uid, mailboxSession.getSessionId(), new StoreMailboxPath<Id>(getMailboxEntity()));
             return uid;
         } catch (IOException e) {
-            e.printStackTrace();
-            throw new MailboxException(HumanReadableText.FAILURE_MAIL_PARSE, e);
+            throw new MailboxException("Unable to parse message", e);
         } catch (MessagingException e) {
-            e.printStackTrace();
-            throw new MailboxException(HumanReadableText.FAILURE_MAIL_PARSE, e);
+            throw new MailboxException("Unable to parse message", e);
         } catch (MimeException e) {
-            e.printStackTrace();
-            throw new MailboxException(HumanReadableText.FAILURE_MAIL_PARSE, e);
+            throw new MailboxException("Unable to parse message", e);
         } finally {
             if (tmpMsgIn != null) {
                 try {
@@ -472,7 +468,7 @@ public abstract class StoreMessageManage
                 dispatcher.added(copiedUids.next(), session.getSessionId(), new StoreMailboxPath<Id>(toMailbox.getMailboxEntity()));
             }
         } catch (MessagingException e) {
-            throw new MailboxException(HumanReadableText.FAILURE_MAIL_PARSE, e);
+            throw new MailboxException("Unable to parse message", e);
         }
     }
     

Modified: james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreSubscriptionManager.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreSubscriptionManager.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreSubscriptionManager.java (original)
+++ james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreSubscriptionManager.java Mon Sep  6 17:19:17 2010
@@ -62,7 +62,7 @@ public abstract class StoreSubscriptionM
                 
             });
         } catch (MailboxException e) {
-            throw new SubscriptionException(e.getKey(), (Exception) e.getCause());
+            throw new SubscriptionException(e);
         }
     }
 
@@ -108,7 +108,7 @@ public abstract class StoreSubscriptionM
 
             });
         } catch (MailboxException e) {
-            throw new SubscriptionException(e.getKey(), (Exception)e.getCause());
+            throw new SubscriptionException(e);
         }
     }
 

Modified: james/imap/trunk/store/src/main/java/org/apache/james/imap/store/mail/MailboxMapper.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/store/src/main/java/org/apache/james/imap/store/mail/MailboxMapper.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/store/src/main/java/org/apache/james/imap/store/mail/MailboxMapper.java (original)
+++ james/imap/trunk/store/src/main/java/org/apache/james/imap/store/mail/MailboxMapper.java Mon Sep  6 17:19:17 2010
@@ -20,9 +20,9 @@ package org.apache.james.imap.store.mail
 
 import java.util.List;
 
-import org.apache.james.imap.api.MailboxPath;
+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.model.Mailbox;
 import org.apache.james.imap.store.transaction.Mapper;
 
@@ -37,65 +37,65 @@ public interface MailboxMapper<Id> exten
      * Save the give {@link Mailbox} to the underlying storage
      * 
      * @param mailbox
-     * @throws StorageException
+     * @throws MailboxException
      */
-    public abstract void save(Mailbox<Id> mailbox) throws StorageException;
+    public abstract void save(Mailbox<Id> mailbox) throws MailboxException;
     
     /**
      * Delete the given {@link Mailbox} from the underlying storage
      * 
      * @param mailbox
-     * @throws StorageException
+     * @throws MailboxException
      */
-    public abstract void delete(Mailbox<Id> mailbox) throws StorageException;
+    public abstract void delete(Mailbox<Id> mailbox) throws MailboxException;
 
     /**
      * Delete all {@link Mailbox} objects from the underlying storage
      * 
-     * @throws StorageException
+     * @throws MailboxException
      */
-    public abstract void deleteAll() throws StorageException;
+    public abstract void deleteAll() throws MailboxException;
 
     /**
      * Return the {@link Mailbox} for the given name
      * 
      * @param name 
      * @return mailbox
-     * @throws StorageException
+     * @throws MailboxException
      * @throws MailboxNotFoundException
      */
     public abstract Mailbox<Id> findMailboxByPath(MailboxPath mailboxName)
-            throws StorageException, MailboxNotFoundException;
+            throws MailboxException, MailboxNotFoundException;
 
     /**
      * Return a List of {@link Mailbox} which name is like the given name
      * 
      * @param name
      * @return mailboxList
-     * @throws StorageException
+     * @throws MailboxException
      */
     public abstract List<Mailbox<Id>> findMailboxWithPathLike(MailboxPath mailboxPath)
-            throws StorageException;
+            throws MailboxException;
 
     /**
      * Return the {@link Mailbox} for the given id
      * 
      * @param mailboxId
      * @return mailbox
-     * @throws StorageException
+     * @throws MailboxException
      * @throws MailboxNotFoundException
      */
     public abstract Mailbox<Id> findMailboxById(Id mailboxId)
-            throws StorageException, MailboxNotFoundException;
+            throws MailboxException, MailboxNotFoundException;
 
     /**
      * Return if the given {@link Mailbox} has children
      * 
      * @param mailbox not null
      * @return true when the mailbox has children, false otherwise
-     * @throws StorageException
+     * @throws MailboxException
      * @throws MailboxNotFoundException
      */
     public abstract boolean hasChildren(Mailbox<Id> mailbox)
-            throws StorageException, MailboxNotFoundException;
+            throws MailboxException, MailboxNotFoundException;
 }
\ No newline at end of file

Modified: james/imap/trunk/store/src/main/java/org/apache/james/imap/store/mail/MessageMapper.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/store/src/main/java/org/apache/james/imap/store/mail/MessageMapper.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/store/src/main/java/org/apache/james/imap/store/mail/MessageMapper.java (original)
+++ james/imap/trunk/store/src/main/java/org/apache/james/imap/store/mail/MessageMapper.java Mon Sep  6 17:19:17 2010
@@ -23,7 +23,7 @@ import java.util.List;
 
 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.MailboxException;
 import org.apache.james.imap.store.mail.model.Message;
 import org.apache.james.imap.store.mail.model.Mailbox;
 import org.apache.james.imap.store.mail.model.MailboxMembership;
@@ -42,10 +42,10 @@ public interface MessageMapper<Id> exten
      * @param mailbox The mailbox to search
      * @param set
      * @return list
-     * @throws StorageException
+     * @throws MailboxException
      */
     public abstract List<MailboxMembership<Id>> findInMailbox(Mailbox<Id> mailbox, MessageRange set)
-            throws StorageException;
+            throws MailboxException;
 
     /**
      * Return a List of {@link MailboxMembership} for the given {@link MessageRange} which are marked for deletion
@@ -53,21 +53,21 @@ public interface MessageMapper<Id> exten
      * @param mailbox
      * @param set 
      * @return list
-     * @throws StorageException
+     * @throws MailboxException
      */
     public abstract List<MailboxMembership<Id>> findMarkedForDeletionInMailbox(
             Mailbox<Id> mailbox, final MessageRange set)
-            throws StorageException;
+            throws MailboxException;
 
     /**
      * Return the count of messages in the mailbox
      * 
      * @param mailbox
      * @return count
-     * @throws StorageException
+     * @throws MailboxException
      */
     public abstract long countMessagesInMailbox(Mailbox<Id> mailbox)
-            throws StorageException;
+            throws MailboxException;
 
     /**
      * Return the count of unseen messages in the mailbox
@@ -77,7 +77,7 @@ public interface MessageMapper<Id> exten
      * @throws StorageException
      */
     public abstract long countUnseenMessagesInMailbox(Mailbox<Id> mailbox)
-            throws StorageException;
+            throws MailboxException;
 
     /**
      * Return a List of uids which matched the {@link SearchQuery}
@@ -87,7 +87,7 @@ public interface MessageMapper<Id> exten
      * @return
      * @throws StorageException
      */
-    public abstract Iterator<Long> searchMailbox(Mailbox<Id> mailbox, SearchQuery query) throws StorageException;
+    public abstract Iterator<Long> searchMailbox(Mailbox<Id> mailbox, SearchQuery query) throws MailboxException;
 
     /**
      * Delete the given {@link MailboxMembership}
@@ -96,7 +96,7 @@ public interface MessageMapper<Id> exten
      * @param message
      * @throws StorageException
      */
-    public abstract void delete(Mailbox<Id> mailbox, MailboxMembership<Id> message) throws StorageException;
+    public abstract void delete(Mailbox<Id> mailbox, MailboxMembership<Id> message) throws MailboxException;
 
     /**
      * Return the uid of the first unseen message. If non can be found null will get returned
@@ -106,7 +106,7 @@ public interface MessageMapper<Id> exten
      * @return uid or null
      * @throws StorageException
      */
-    public abstract Long findFirstUnseenMessageUid(Mailbox<Id> mailbox) throws StorageException;
+    public abstract Long findFirstUnseenMessageUid(Mailbox<Id> mailbox) throws MailboxException;
 
     /**
      * Return a List of {@link MailboxMembership} which are recent.
@@ -119,7 +119,7 @@ public interface MessageMapper<Id> exten
      * @return recentList
      * @throws StorageException
      */
-    public abstract List<MailboxMembership<Id>> findRecentMessagesInMailbox(Mailbox<Id> mailbox, int limit) throws StorageException;
+    public abstract List<MailboxMembership<Id>> findRecentMessagesInMailbox(Mailbox<Id> mailbox, int limit) throws MailboxException;
 
 
     /**
@@ -131,7 +131,7 @@ public interface MessageMapper<Id> exten
      * @param message
      * @throws StorageException
      */
-    public abstract long save(Mailbox<Id> mailbox, MailboxMembership<Id> message) throws StorageException;
+    public abstract long save(Mailbox<Id> mailbox, MailboxMembership<Id> message) throws MailboxException;
     
     
     /**
@@ -143,6 +143,6 @@ public interface MessageMapper<Id> exten
      * @return The uid of the copied instance
      * @throws StorageException
      */
-    public abstract long copy(Mailbox<Id> mailbox, MailboxMembership<Id> original) throws StorageException;
+    public abstract long copy(Mailbox<Id> mailbox, MailboxMembership<Id> original) throws MailboxException;
 
 }
\ No newline at end of file

Modified: james/imap/trunk/store/src/test/java/org/apache/james/imap/store/SearchUtilsMultipartMixedTest.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/store/src/test/java/org/apache/james/imap/store/SearchUtilsMultipartMixedTest.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/store/src/test/java/org/apache/james/imap/store/SearchUtilsMultipartMixedTest.java (original)
+++ james/imap/trunk/store/src/test/java/org/apache/james/imap/store/SearchUtilsMultipartMixedTest.java Mon Sep  6 17:19:17 2010
@@ -25,7 +25,6 @@ import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.Collection;
 
-import org.apache.james.imap.api.ImapConstants;
 import org.apache.james.imap.mailbox.SearchQuery;
 import org.apache.james.imap.store.mail.model.MailboxMembership;
 import org.junit.Before;
@@ -115,10 +114,10 @@ public class SearchUtilsMultipartMixedTe
     public void setUp() throws Exception {
         final MessageBuilder builder = new MessageBuilder();
         
-        builder.header(ImapConstants.RFC822_FROM, "Alex <alex@example.org");
-        builder.header(ImapConstants.RFC822_TO, "Harry <harry@example.org");
-        builder.header(ImapConstants.RFC822_SUBJECT, "A Mixed Multipart Mail");
-        builder.header(ImapConstants.RFC822_DATE, "Thu, 14 Feb 2008 12:00:00 +0000 (GMT)");
+        builder.header("From", "Alex <alex@example.org");
+        builder.header("To", "Harry <harry@example.org");
+        builder.header("Subject", "A Mixed Multipart Mail");
+        builder.header("Date", "Thu, 14 Feb 2008 12:00:00 +0000 (GMT)");
         builder.header("Content-Type", "multipart/mixed;boundary=1729");
         builder.body = Charset.forName("us-ascii").encode(BODY).array();
         row = builder.build();

Modified: james/imap/trunk/store/src/test/java/org/apache/james/imap/store/SearchUtilsRFC822Test.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/store/src/test/java/org/apache/james/imap/store/SearchUtilsRFC822Test.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/store/src/test/java/org/apache/james/imap/store/SearchUtilsRFC822Test.java (original)
+++ james/imap/trunk/store/src/test/java/org/apache/james/imap/store/SearchUtilsRFC822Test.java Mon Sep  6 17:19:17 2010
@@ -25,7 +25,6 @@ import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.Collection;
 
-import org.apache.james.imap.api.ImapConstants;
 import org.apache.james.imap.mailbox.SearchQuery;
 import org.apache.james.imap.store.mail.model.MailboxMembership;
 import org.junit.Before;
@@ -55,10 +54,10 @@ public class SearchUtilsRFC822Test {
     public void setUp() throws Exception {
         recent = new ArrayList<Long>();
         MessageBuilder builder = new MessageBuilder();
-        builder.header(ImapConstants.RFC822_FROM, "Alex <alex@example.org");
-        builder.header(ImapConstants.RFC822_TO, FROM_ADDRESS);
-        builder.header(ImapConstants.RFC822_SUBJECT, "A " + SUBJECT_PART + " Multipart Mail");
-        builder.header(ImapConstants.RFC822_DATE, "Thu, 14 Feb 2008 12:00:00 +0000 (GMT)");
+        builder.header("From", "Alex <alex@example.org");
+        builder.header("To", FROM_ADDRESS);
+        builder.header("Subject", "A " + SUBJECT_PART + " Multipart Mail");
+        builder.header("Date", "Thu, 14 Feb 2008 12:00:00 +0000 (GMT)");
         builder.body = Charset.forName("us-ascii").encode(BODY).array();
         row = builder.build();
         searches = new MessageSearches();

Modified: james/imap/trunk/store/src/test/java/org/apache/james/imap/store/SearchUtilsTest.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/store/src/test/java/org/apache/james/imap/store/SearchUtilsTest.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/store/src/test/java/org/apache/james/imap/store/SearchUtilsTest.java (original)
+++ james/imap/trunk/store/src/test/java/org/apache/james/imap/store/SearchUtilsTest.java Mon Sep  6 17:19:17 2010
@@ -27,7 +27,6 @@ import java.util.Date;
 
 import javax.mail.Flags;
 
-import org.apache.james.imap.api.ImapConstants;
 import org.apache.james.imap.mailbox.SearchQuery;
 import org.apache.james.imap.store.mail.model.MailboxMembership;
 import org.junit.Before;
@@ -43,9 +42,9 @@ public class SearchUtilsTest {
 
     private static final int SIZE = 1729;
 
-    private static final String DATE_FIELD = ImapConstants.RFC822_DATE;
+    private static final String DATE_FIELD = "Date";
 
-    private static final String SUBJECT_FIELD = ImapConstants.RFC822_SUBJECT;
+    private static final String SUBJECT_FIELD = "Subject";
 
     private static final String RFC822_SUN_SEP_9TH_2001 = "Sun, 9 Sep 2001 09:10:48 +0000 (GMT)";
 

Modified: james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/LockException.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/LockException.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/LockException.java (original)
+++ james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/LockException.java Mon Sep  6 17:19:17 2010
@@ -21,7 +21,6 @@ package org.apache.james.mailboxmanager.
 
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.Lock;
-import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.mailbox.MailboxException;
 
 /**
@@ -32,24 +31,24 @@ public class LockException extends Mailb
 
     private static final long serialVersionUID = 698379731076300030L;
 
-    public LockException(HumanReadableText key, String message) {
-        super(key, message);
+    public LockException(String message) {
+        super(message);
     }
 
-    public LockException(HumanReadableText key) {
-        super(key);}
+    public LockException() {
+        super();}
 
-    public LockException(HumanReadableText key, Exception cause) {
-        super(key, cause);
+    public LockException(Exception cause) {
+        super(null, cause);
     }
 
     public static void tryLock(final Lock lock, final int timeoutInSeconds) throws LockException {
         try {
             if (!lock.tryLock(timeoutInSeconds, TimeUnit.SECONDS)) {
-                throw new LockException(HumanReadableText.LOCK_FAILED);
+                throw new LockException("Lock failed");
             }
         } catch (InterruptedException e) {
-            throw new LockException(HumanReadableText.LOCK_FAILED, e);
+            throw new LockException("Lock failed");
         }
     }
 

Modified: james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java (original)
+++ james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java Mon Sep  6 17:19:17 2010
@@ -45,8 +45,8 @@ import javax.mail.Flags;
 import javax.mail.MessagingException;
 import javax.mail.internet.MimeMessage;
 
-import org.apache.james.imap.api.MailboxPath;
-import org.apache.james.imap.api.display.HumanReadableText;
+import org.apache.james.imap.mailbox.MailboxNotFoundException;
+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;
@@ -116,7 +116,7 @@ public class TorqueMailbox implements Me
             try {
                 return getMailboxRow().countMessages();
             } catch (Exception e) {
-                throw new MailboxException(HumanReadableText.COUNT_FAILED, e);
+                throw new MailboxException("Count of messages in mailbox " + getName() + " failed", e);
             }
         } finally {
             unlockAfterReading();
@@ -199,7 +199,7 @@ public class TorqueMailbox implements Me
                     return messageResult.getUid();
                 } catch (Exception e) {
                     e.printStackTrace();
-                    throw new MailboxException(HumanReadableText.FAILURE_MAIL_PARSE, e);
+                    throw new MailboxException("Parsing of message failed", e);
                 } finally {
                     if (file != null) {
                         file.delete();
@@ -207,10 +207,10 @@ public class TorqueMailbox implements Me
                 }
             } else {
                 // mailboxRow==null
-                throw new MailboxException(HumanReadableText.MAILBOX_DELETED);
+                throw new MailboxNotFoundException(getName());
             }
         } catch (InterruptedException e) {
-            throw new MailboxException(HumanReadableText.LOCK_FAILED, e);
+            throw new LockException(e);
         }
     }
 
@@ -283,9 +283,9 @@ public class TorqueMailbox implements Me
             lockForWriting();
             myMailboxRow = getMailboxRow().consumeNextUid();
         } catch (TorqueException e) {
-            throw new MailboxException(HumanReadableText.COMSUME_UID_FAILED, e);
+            throw new MailboxException("Consume next uid failed", e);
         } catch (SQLException e) {
-            throw new MailboxException(HumanReadableText.COMSUME_UID_FAILED, e);
+            throw new MailboxException("Consume next uid failed", e);
         } finally {
             unlockAfterWriting();
         }
@@ -337,9 +337,9 @@ public class TorqueMailbox implements Me
                         .getMailboxId());
                 return getMessages(fetchGroup, set, c, mailboxSession);
             } catch (TorqueException e) {
-                throw new MailboxException(HumanReadableText.SEARCH_FAILED, e);
+                throw new MailboxException("Search failed", e);
             } catch (MessagingException e) {
-                throw new MailboxException(HumanReadableText.FAILURE_MAIL_PARSE, e);
+                throw new MailboxException("Parsing of message failed", e);
             }
         } finally {
             unlockAfterReading();
@@ -403,7 +403,7 @@ public class TorqueMailbox implements Me
             }
             return results;
         } catch (TorqueException e) {
-            throw new MailboxException(HumanReadableText.SEARCH_FAILED, e);
+            throw new MailboxException("Search failed", e);
         } finally {
             unlockAfterReading();
         }
@@ -450,11 +450,11 @@ public class TorqueMailbox implements Me
                     return null;
                 }
             } catch (TorqueException e) {
-                throw new MailboxException(HumanReadableText.SEARCH_FAILED, e);
+                throw new MailboxException("Search failed", e);
             } catch (MessagingException e) {
-                throw new MailboxException(HumanReadableText.FAILURE_MAIL_PARSE, e);
+                throw new MailboxException("Parsing of message failed", e);
             } catch (MimeException e) {
-                throw new MailboxException(HumanReadableText.FAILURE_MAIL_PARSE, e);
+                throw new MailboxException("Parsing of message failed", e);
             }
         } finally {
             unlockAfterReading();
@@ -471,9 +471,9 @@ public class TorqueMailbox implements Me
                         new Flags(Flags.Flag.SEEN), false);
                 return count;
             } catch (TorqueException e) {
-                throw new MailboxException(HumanReadableText.COUNT_FAILED, e);
+                throw new MailboxException("count failed", e);
             } catch (DataSetException e) {
-                throw new MailboxException(HumanReadableText.COUNT_FAILED, e);
+                throw new MailboxException("count failed", e);
             }
         } finally {
             unlockAfterReading();
@@ -516,7 +516,7 @@ public class TorqueMailbox implements Me
             getUidChangeTracker().expunged(uids);
             return uids.iterator();
         } catch (TorqueException e) {
-            throw new MailboxException(HumanReadableText.DELETED_FAILED, e);
+            throw new MailboxException("delete failed", e);
         }
     }
 
@@ -561,7 +561,7 @@ public class TorqueMailbox implements Me
             tracker.flagsUpdated(newFlagsByUid, originalFlagsByUid, mailboxSession.getSessionId());
             return newFlagsByUid;
         } catch (TorqueException e) {
-            throw new MailboxException(HumanReadableText.SAVE_FAILED, e);
+            throw new MailboxException("save failed", e);
         }
     }
 
@@ -596,14 +596,14 @@ public class TorqueMailbox implements Me
                     final long lastUid = mailboxRow.getLastUid();
                     return lastUid + 1;
                 } else {
-                    throw new MailboxException(HumanReadableText.MAILBOX_DELETED);
+                    throw new MailboxException("consume failed");
                 }
             } catch (NoRowsException e) {
-                throw new MailboxException(HumanReadableText.COMSUME_UID_FAILED, e);
+                throw new MailboxException("consume failed");
             } catch (TooManyRowsException e) {
-                throw new MailboxException(HumanReadableText.COMSUME_UID_FAILED, e);
+                throw new MailboxException("consume failed");
             } catch (TorqueException e) {
-                throw new MailboxException(HumanReadableText.COMSUME_UID_FAILED, e);
+                throw new MailboxException("consume failed");
             }
         } finally {
             unlockAfterReading();
@@ -655,9 +655,9 @@ public class TorqueMailbox implements Me
 
             return uids.iterator();
         } catch (TorqueException e) {
-            throw new MailboxException(HumanReadableText.SEARCH_FAILED, e);
+            throw new MailboxException("search failed");
         } catch (MimeException e) {
-            throw new MailboxException(HumanReadableText.FAILURE_MAIL_PARSE, e);
+            throw new MailboxException("Parsing of message failed");
         } finally {
             unlockAfterReading();
         }
@@ -723,9 +723,9 @@ public class TorqueMailbox implements Me
                 rows = MessageRowPeer.doSelectJoinMessageFlags(c);
                 
             } catch (TorqueException e) {
-                throw new MailboxException(HumanReadableText.SAVE_FAILED, e);
+                throw new MailboxException("save failed");
             } catch (MessagingException e) {
-                throw new MailboxException(HumanReadableText.FAILURE_MAIL_PARSE, e);
+                throw new MailboxException("parsing of message failed");
             }
         } finally {
             unlockAfterReading();
@@ -790,13 +790,14 @@ public class TorqueMailbox implements Me
                 }
             }
         } catch (TorqueException e) {
-            throw new MailboxException(HumanReadableText.SAVE_FAILED, e);
+            throw new MailboxException("save failed");
         } catch (InterruptedException e) {
-            throw new MailboxException(HumanReadableText.LOCK_FAILED, e);
+            throw new LockException();
         } catch (MessagingException e) {
-            throw new MailboxException(HumanReadableText.FAILURE_MAIL_PARSE, e);
+            throw new MailboxException("parsing of message failed");
         } catch (MimeException e) {
-            throw new MailboxException(HumanReadableText.FAILURE_MAIL_PARSE, e);
+            throw new MailboxException("parsing of message failed");
+
         }
     }
 

Modified: james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManager.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManager.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManager.java (original)
+++ james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManager.java Mon Sep  6 17:19:17 2010
@@ -31,10 +31,9 @@ import java.util.concurrent.locks.Reentr
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.james.imap.api.MailboxPath;
-import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.mailbox.BadCredentialsException;
 import org.apache.james.imap.mailbox.MailboxManager;
+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;
@@ -206,7 +205,7 @@ public class TorqueMailboxManager implem
                 }
             }
         } catch (TorqueException e) {
-            throw new MailboxException(HumanReadableText.SEARCH_FAILED, e);
+            throw new MailboxException("parsing of message failed");
         }
     }
 
@@ -262,7 +261,7 @@ public class TorqueMailboxManager implem
         try {
             mr.save();
         } catch (TorqueException e) {
-            throw new MailboxException(HumanReadableText.SAVE_FAILED, e);
+            throw new MailboxException("save failed");
         }
     }
 
@@ -285,7 +284,7 @@ public class TorqueMailboxManager implem
                     mailbox.deleted(session);
                 }
             } catch (TorqueException e) {
-                throw new MailboxException(HumanReadableText.DELETED_FAILED, e);
+                throw new MailboxException("delete failed");
             }
         }
     }
@@ -334,7 +333,7 @@ public class TorqueMailboxManager implem
                 }
             }
         } catch (TorqueException e) {
-            throw new MailboxException(HumanReadableText.SAVE_FAILED, e);
+            throw new MailboxException("save failed");
         }
     }
 
@@ -395,7 +394,7 @@ public class TorqueMailboxManager implem
             Collections.sort(results, new StandardMailboxMetaDataComparator());
             return results;
         } catch (TorqueException e) {
-            throw new MailboxException(HumanReadableText.SEARCH_FAILED, e);
+            throw new MailboxException("search failed");
         }
 
     }
@@ -431,13 +430,12 @@ public class TorqueMailboxManager implem
                     if (count == 1) {
                         return true;
                     } else {
-                        throw new MailboxException(HumanReadableText.DUPLICATE_MAILBOXES, 
-                                "found " + count + " mailboxes");
+                        throw new MailboxException("found " + count + " mailboxes");
                     }
                 }
             }
         } catch (TorqueException e) {
-            throw new MailboxException(HumanReadableText.SEARCH_FAILED, e);
+            throw new MailboxException("search failed");
         }
     }
 
@@ -456,7 +454,7 @@ public class TorqueMailboxManager implem
                     Criteria.GREATER_THAN));
             mailboxes.clear();
         } catch (TorqueException e) {
-            throw new MailboxException(HumanReadableText.DELETED_FAILED, e);
+            throw new MailboxException("save failed");
         }
     }
 

Modified: james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueResultIterator.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueResultIterator.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueResultIterator.java (original)
+++ james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueResultIterator.java Mon Sep  6 17:19:17 2010
@@ -30,7 +30,6 @@ import javax.mail.internet.MimeMessage;
 import org.apache.commons.collections.Buffer;
 import org.apache.commons.collections.BufferUtils;
 import org.apache.commons.collections.buffer.BoundedFifoBuffer;
-import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.mailbox.Content;
 import org.apache.james.imap.mailbox.MailboxException;
 import org.apache.james.imap.mailbox.MessageResult;
@@ -93,11 +92,11 @@ public class TorqueResultIterator implem
                     this.fetchGroup);
         } catch (TorqueException e) {
             result = new UnloadedMessageResult(messageRow,
-                    new MailboxException(HumanReadableText.SEARCH_FAILED, e));
+                    new MailboxException("Search failed", e));
         } catch (MailboxException e) {
             result = new UnloadedMessageResult(messageRow, e);
         } catch (MimeException e) {
-            result = new UnloadedMessageResult(messageRow, new MailboxException(HumanReadableText.FAILURE_MAIL_PARSE, e));
+            result = new UnloadedMessageResult(messageRow, new MailboxException("Parsing message failed", e));
         }
         return result;
     }

Modified: james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/UidChangeTracker.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/UidChangeTracker.java?rev=993100&r1=993099&r2=993100&view=diff
==============================================================================
--- james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/UidChangeTracker.java (original)
+++ james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/UidChangeTracker.java Mon Sep  6 17:19:17 2010
@@ -30,9 +30,9 @@ import java.util.TreeSet;
 
 import javax.mail.Flags;
 
-import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.mailbox.MailboxConstants;
 import org.apache.james.imap.mailbox.MailboxListener;
+import org.apache.james.imap.mailbox.MailboxPath;
 import org.apache.james.imap.mailbox.util.MailboxEventDispatcher;
 import org.apache.james.imap.mailbox.MessageRange;
 



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