protected void processGreeting(Response r) throws ProtocolException { if (r.isBYE()) throw new ConnectionException(this, r); }
protected void checkRange(int msgno) throws MessagingException { if (msgno < 1) // message-numbers start at 1 throw new IndexOutOfBoundsException("message number < 1"); if (msgno <= total) return; // Out of range, let's ping the server and see if // the server has more messages for us. synchronized(messageCacheLock) { // Acquire lock try { keepConnectionAlive(false); } catch (ConnectionException cex) { // Oops, lost connection throw new FolderClosedException(this, cex.getMessage()); } catch (ProtocolException pex) { throw new MessagingException(pex.getMessage(), pex); } } // Release lock if (msgno > total) // Still out of range ? Throw up ... throw new IndexOutOfBoundsException(msgno + " > " + total); }
/** * Throw the appropriate 'closed' exception. * * @param cex the ConnectionException * @exception FolderClosedException if the folder is closed * @exception StoreClosedException if the store is closed */ protected synchronized void throwClosedException(ConnectionException cex) throws FolderClosedException, StoreClosedException { // If it's the folder's protocol object, throw a FolderClosedException; // otherwise, throw a StoreClosedException. // If a command has failed because the connection is closed, // the folder will have already been forced closed by the // time we get here and our protocol object will have been // released, so if we no longer have a protocol object we base // this decision on whether we *think* the folder is open. if ((protocol != null && cex.getProtocol() == protocol) || (protocol == null && !reallyClosed)) throw new FolderClosedException(this, cex.getMessage()); else throw new StoreClosedException(store, cex.getMessage()); }
protected void checkRange(int msgno) throws MessagingException { if (msgno < 1) // message-numbers start at 1 throw new IndexOutOfBoundsException("message number < 1"); if (msgno <= total) return; // Out of range, let's ping the server and see if // the server has more messages for us. synchronized(messageCacheLock) { // Acquire lock try { keepConnectionAlive(false); } catch (ConnectionException cex) { // Oops, lost connection throw new FolderClosedException(this, cex.getMessage()); } catch (ProtocolException pex) { throw new MessagingException(pex.getMessage(), pex); } } // Release lock if (msgno > total) // Still out of range ? Throw up ... throw new IndexOutOfBoundsException(msgno + " > " + total); }
protected void processGreeting(Response r) throws ProtocolException { if (r.isBYE()) throw new ConnectionException(this, r); }
/** * Throw the appropriate 'closed' exception. * * @param cex the ConnectionException * @exception FolderClosedException if the folder is closed * @exception StoreClosedException if the store is closed */ protected synchronized void throwClosedException(ConnectionException cex) throws FolderClosedException, StoreClosedException { // If it's the folder's protocol object, throw a FolderClosedException; // otherwise, throw a StoreClosedException. // If a command has failed because the connection is closed, // the folder will have already been forced closed by the // time we get here and our protocol object will have been // released, so if we no longer have a protocol object we base // this decision on whether we *think* the folder is open. if ((protocol != null && cex.getProtocol() == protocol) || (protocol == null && !reallyClosed)) throw new FolderClosedException(this, cex.getMessage()); else throw new StoreClosedException(store, cex.getMessage()); }
throw new FolderClosedException(this, cex.getMessage()); } catch (ProtocolException pex) { throw new MessagingException(pex.getMessage(), pex);
/** * Return the IMAPProtocol object for this folder. <p> * * This method will block if necessary to wait for an IDLE * command to finish. * * @return the IMAPProtocol object used when the folder is open * @exception ProtocolException for protocol errors */ protected IMAPProtocol getProtocol() throws ProtocolException { assert Thread.holdsLock(messageCacheLock); waitIfIdle(); // if we no longer have a protocol object after waiting, it probably // means the connection has been closed due to a communnication error, // or possibly because the folder has been closed if (protocol == null) throw new ConnectionException("Connection closed"); return protocol; }
/** * Throw the appropriate 'closed' exception. */ private synchronized void throwClosedException(ConnectionException cex) throws FolderClosedException, StoreClosedException { // If it's the folder's protocol object, throw a FolderClosedException; // otherwise, throw a StoreClosedException. // If a command has failed because the connection is closed, // the folder will have already been forced closed by the // time we get here and our protocol object will have been // released, so if we no longer have a protocol object we base // this decision on whether we *think* the folder is open. if ((protocol != null && cex.getProtocol() == protocol) || (protocol == null && !reallyClosed)) throw new FolderClosedException(this, cex.getMessage()); else throw new StoreClosedException(store, cex.getMessage()); }
throw new FolderClosedException(this, cex.getMessage()); } catch (ProtocolException pex) { throw new MessagingException(pex.getMessage(), pex);
/** * Return the IMAPProtocol object for this folder. <p> * * This method will block if necessary to wait for an IDLE * command to finish. * * @return the IMAPProtocol object used when the folder is open * @exception ProtocolException for protocol errors */ protected IMAPProtocol getProtocol() throws ProtocolException { assert Thread.holdsLock(messageCacheLock); waitIfIdle(); // if we no longer have a protocol object after waiting, it probably // means the connection has been closed due to a communnication error, // or possibly because the folder has been closed if (protocol == null) throw new ConnectionException("Connection closed"); return protocol; }
/** * Throw the appropriate 'closed' exception. */ protected synchronized void throwClosedException(ConnectionException cex) throws FolderClosedException, StoreClosedException { // If it's the folder's protocol object, throw a FolderClosedException; // otherwise, throw a StoreClosedException. // If a command has failed because the connection is closed, // the folder will have already been forced closed by the // time we get here and our protocol object will have been // released, so if we no longer have a protocol object we base // this decision on whether we *think* the folder is open. if ((protocol != null && cex.getProtocol() == protocol) || (protocol == null && !reallyClosed)) throw new FolderClosedException(this, cex.getMessage()); else throw new StoreClosedException(store, cex.getMessage()); }
throw new FolderClosedException(this, cex.getMessage()); } catch (ProtocolException pex) { throw new MessagingException(pex.getMessage(), pex);
if (r.isBYE()) { throw new ConnectionException(this, r); } else { disconnect(); throw new ConnectionException(this, r);
throw new FolderClosedException(this, cex.getMessage()); } catch (ProtocolException pex) { throw new MessagingException(pex.getMessage(), pex);
if (r.isBYE()) { throw new ConnectionException(this, r); } else { disconnect(); throw new ConnectionException(this, r);
throw new FolderClosedException(this, cex.getMessage()); } catch (ProtocolException pex) { throw new MessagingException(pex.getMessage(), pex);
/** * Convenience routine to handle OK, NO, BAD and BYE responses. * * @param response the response * @exception ProtocolException for protocol failures */ public void handleResult(Response response) throws ProtocolException { if (response.isOK()) return; else if (response.isNO()) throw new CommandFailedException(response); else if (response.isBAD()) throw new BadCommandException(response); else if (response.isBYE()) { disconnect(); throw new ConnectionException(this, response); } }
throw new FolderClosedException(this, cex.getMessage()); } catch (ProtocolException pex) { throw new MessagingException(pex.getMessage(), pex);
throw new ConnectionException( "failed to create new store connection");