You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by rd...@apache.org on 2008/12/29 17:07:18 UTC

svn commit: r729925 - /james/protocols/imap/trunk/jpa/src/main/java/org/apache/james/imap/jpa/JPAMailbox.java

Author: rdonkin
Date: Mon Dec 29 08:07:18 2008
New Revision: 729925

URL: http://svn.apache.org/viewvc?rev=729925&view=rev
Log:
Open is only ever true so remove it.

Modified:
    james/protocols/imap/trunk/jpa/src/main/java/org/apache/james/imap/jpa/JPAMailbox.java

Modified: james/protocols/imap/trunk/jpa/src/main/java/org/apache/james/imap/jpa/JPAMailbox.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/jpa/src/main/java/org/apache/james/imap/jpa/JPAMailbox.java?rev=729925&r1=729924&r2=729925&view=diff
==============================================================================
--- james/protocols/imap/trunk/jpa/src/main/java/org/apache/james/imap/jpa/JPAMailbox.java (original)
+++ james/protocols/imap/trunk/jpa/src/main/java/org/apache/james/imap/jpa/JPAMailbox.java Mon Dec 29 08:07:18 2008
@@ -66,8 +66,6 @@
 
     private Log log;
 
-    private boolean open = true;
-
     private long mailboxId;
 
     private final UidChangeTracker tracker;
@@ -91,7 +89,6 @@
     }
 
     public synchronized String getName() throws MailboxManagerException {
-        checkAccess();
         try {
             return getMailboxRow().getName();
         } catch (TorqueException e) {
@@ -104,7 +101,6 @@
         try {
             lock.readLock().acquire();
             try {
-                checkAccess();
                 try {
                     return messageMapper.countMessages(getMailboxRow().getMailboxId());
                 } catch (Exception e) {
@@ -123,8 +119,6 @@
     throws MailboxManagerException {
 
         try {
-            checkAccess();
-
             final MailboxRow mailbox = reserveNextUid();
 
             if (mailbox != null) {
@@ -255,7 +249,6 @@
         try {
             lock.readLock().acquire();
             try {
-                checkAccess();
                 UidRange range = uidRangeForMessageSet(set);
                 try {
                     final long mailboxId = getMailboxRow().getMailboxId();
@@ -322,7 +315,6 @@
         try {
             lock.readLock().acquire();
             try {
-                checkAccess();
                 final MailboxRow mailboxRow = getMailboxRow();
                 final List messageRows = messageMapper.findRecent(mailboxRow);
                 final long[] results = new long[messageRows.size()];
@@ -354,7 +346,6 @@
         try {
             lock.readLock().acquire();
             try {
-                checkAccess();
                 try {
                     List messageRows = messageMapper.findUnseen(getMailboxRow());
                     if (messageRows.size() > 0) {
@@ -388,7 +379,6 @@
         try {
             lock.readLock().acquire();
             try {
-                checkAccess();
                 try {
                     final int count = messageMapper.countMessages(
                             new Flags(Flags.Flag.SEEN), false, getMailboxRow().getMailboxId());
@@ -423,7 +413,6 @@
 
     private Iterator doExpunge(final MessageRange set, FetchGroup fetchGroup)
     throws MailboxManagerException {
-        checkAccess();
         try {
             // TODO put this into a serializable transaction
             final MailboxRow mailboxRow = getMailboxRow();
@@ -478,7 +467,6 @@
     private Iterator doSetFlags(Flags flags, boolean value, boolean replace,
             final MessageRange set, FetchGroup fetchGroup,
             MailboxSession mailboxSession) throws MailboxManagerException {
-        checkAccess();
         try {
             // TODO put this into a serializeable transaction
             final List messageRows = mapper.findInMailbox(set, getMailboxRow().getMailboxId());
@@ -519,14 +507,10 @@
 
     public void addListener(MailboxListener listener)
     throws MailboxManagerException {
-        checkAccess();
         tracker.addMailboxListener(listener);
     }
 
     public void removeListener(MailboxListener mailboxListener) {
-        if (!open) {
-            throw new RuntimeException("mailbox not open");
-        }
         tracker.removeMailboxListener(mailboxListener);
     }
 
@@ -535,7 +519,6 @@
         try {
             lock.readLock().acquire();
             try {
-                checkAccess();
                 final long result = getMailboxRow().getUidValidity();
                 return result;
             } finally {
@@ -555,7 +538,6 @@
         try {
             lock.readLock().acquire();
             try {
-                checkAccess();
                 MailboxRow mailbox = getMailboxRow();
                 if (mailbox != null) {
                     getUidChangeTracker().foundLastUid(mailbox.getLastUid());
@@ -575,12 +557,6 @@
         }
     }
 
-    private void checkAccess() {
-        if (!open) {
-            throw new RuntimeException("mailbox is closed");
-        }
-    }
-
     protected UidChangeTracker getUidChangeTracker() {
         return tracker;
     }
@@ -594,7 +570,6 @@
         try {
             lock.readLock().acquire();
             try {
-                checkAccess();
 
                 final List rows = messageMapper.find(query);
                 final List filteredMessages = new ArrayList();
@@ -642,7 +617,6 @@
         try {
             lock.readLock().acquire();
             try {
-                checkAccess();
                 try {
                     List rows = mapper.findInMailbox(set, getMailboxRow().getMailboxId());
                     toMailbox.copy(rows, session);



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org