Exactly that was why exists check was introduced.. safety first ;) Bye, Norman
2010/9/10 Tim-Christian Mundt <[email protected]>: > I just remembered why the previous implementation was so complicated: > with maildir your approach wouldn't work. It only does, because there > the MailboxMapper handles this case on its own. You surely knew about > this and that's why you introduced the "if not exists line". > > Just wanted to make this explicit... > > > Am Freitag, den 10.09.2010, 21:13 +0200 schrieb Tim-Christian Mundt: >> Hi Norman, >> >> this is so stunningly simple that I first didn't understand it. That's >> really better! >> >> Tim >> >> Am Donnerstag, den 09.09.2010, 18:32 +0000 schrieb [email protected]: >> > Author: norman >> > Date: Thu Sep 9 18:32:47 2010 >> > New Revision: 995531 >> > >> > URL: http://svn.apache.org/viewvc?rev=995531&view=rev >> > Log: >> > better handling of INBOX rename (IMAP-208) >> > >> > Modified: >> > >> > james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/RenameProcessor.java >> > >> > 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=995531&r1=995530&r2=995531&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 >> > Thu Sep 9 18:32:47 2010 >> > @@ -35,7 +35,6 @@ import org.apache.james.mailbox.MailboxM >> > import org.apache.james.mailbox.MailboxNotFoundException; >> > import org.apache.james.mailbox.MailboxPath; >> > import org.apache.james.mailbox.MailboxSession; >> > -import org.apache.james.mailbox.MessageRange; >> > >> > public class RenameProcessor extends AbstractMailboxProcessor { >> > >> > @@ -57,22 +56,13 @@ public class RenameProcessor extends Abs >> > try { >> > final MailboxManager mailboxManager = getMailboxManager(); >> > MailboxSession mailboxsession = >> > ImapSessionUtils.getMailboxSession(session); >> > - if >> > (existingPath.getName().equalsIgnoreCase(ImapConstants.INBOX_NAME)) { >> > + mailboxManager.renameMailbox(existingPath, newPath, >> > mailboxsession); >> > >> > - >> > - // if the mailbox is INBOX we need to move move the >> > messages >> > - // https://issues.apache.org/jira/browse/IMAP-188 >> > - MessageRange range = MessageRange.all(); >> > - // create the mailbox if it not exist yet >> > - if (mailboxManager.mailboxExists(newPath, mailboxsession) >> > == false) { >> > - mailboxManager.createMailbox(newPath, mailboxsession); >> > + if >> > (existingPath.getName().equalsIgnoreCase(ImapConstants.INBOX_NAME)) { >> > + if (mailboxManager.mailboxExists(existingPath, >> > mailboxsession) == false) { >> > + mailboxManager.createMailbox(existingPath, >> > mailboxsession); >> > } >> > - mailboxManager.copyMessages(range, existingPath, newPath, >> > mailboxsession); >> > - mailboxManager.deleteMailbox(existingPath, >> > mailboxsession); >> > - mailboxManager.createMailbox(existingPath, >> > mailboxsession); >> > >> > - } else { >> > - mailboxManager.renameMailbox(existingPath, newPath, >> > mailboxsession); >> > } >> > okComplete(command, tag, responder); >> > unsolicitedResponses(session, responder, false); >> > >> > >> > >> > --------------------------------------------------------------------- >> > To unsubscribe, e-mail: [email protected] >> > For additional commands, e-mail: [email protected] >> > >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
