james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e...@apache.org
Subject svn commit: r1152151 - /james/mailbox/trunk/maildir/src/main/java/org/apache/james/mailbox/maildir/mail/MaildirMailboxMapper.java
Date Fri, 29 Jul 2011 09:23:13 GMT
Author: eric
Date: Fri Jul 29 09:23:12 2011
New Revision: 1152151

URL: http://svn.apache.org/viewvc?rev=1152151&view=rev
Log:
Handle correctly INBOX deletion for Maildir (MAILBOX-114)

Modified:
    james/mailbox/trunk/maildir/src/main/java/org/apache/james/mailbox/maildir/mail/MaildirMailboxMapper.java

Modified: james/mailbox/trunk/maildir/src/main/java/org/apache/james/mailbox/maildir/mail/MaildirMailboxMapper.java
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/maildir/src/main/java/org/apache/james/mailbox/maildir/mail/MaildirMailboxMapper.java?rev=1152151&r1=1152150&r2=1152151&view=diff
==============================================================================
--- james/mailbox/trunk/maildir/src/main/java/org/apache/james/mailbox/maildir/mail/MaildirMailboxMapper.java
(original)
+++ james/mailbox/trunk/maildir/src/main/java/org/apache/james/mailbox/maildir/mail/MaildirMailboxMapper.java
Fri Jul 29 09:23:12 2011
@@ -65,11 +65,23 @@ public class MaildirMailboxMapper extend
      * @see org.apache.james.mailbox.store.mail.MailboxMapper#delete(org.apache.james.mailbox.store.mail.model.Mailbox)
      */
     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);
+                if (mailbox.getName().equals(MailboxConstants.INBOX)) {
+                    // We must only delete cur, new, tmp and metadata for top INBOX mailbox.
+                    FileUtils.deleteDirectory(new File(folder, MaildirFolder.CUR));
+                    FileUtils.deleteDirectory(new File(folder, MaildirFolder.NEW));
+                    FileUtils.deleteDirectory(new File(folder, MaildirFolder.TMP));
+                    new File(folder, MaildirFolder.UIDLIST_FILE).delete();
+                    new File(folder, MaildirFolder.VALIDITY_FILE).delete();
+                }
+                else {
+                    // We simply delete all the folder for non INBOX mailboxes.
+                    FileUtils.deleteDirectory(folder);
+                }
             } catch (IOException e) {
                 throw new MailboxException("Unable to delete Mailbox " + mailbox, e);
             }



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