public Object doOptionalCommand(String err, ProtocolCommand cmd) throws MessagingException { try { return doProtocolCommand(cmd); } catch (BadCommandException bex) { throw new MessagingException(err, bex); } catch (ConnectionException cex) { // Oops, the store or folder died on us. throwClosedException(cex); } catch (ProtocolException pex) { throw new MessagingException(pex.getMessage(), pex); } return null; }
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); }
/** * Set the quotas for the quota root specified in the quota argument. * Typically this will be one of the quota roots obtained from the * <code>getQuota</code> method, but it need not be. * * @param quota the quota to set * @exception MessagingException if the server doesn't support the * QUOTA extension */ public synchronized void setQuota(Quota quota) throws MessagingException { checkConnected(); IMAPProtocol p = null; try { p = getStoreProtocol(); p.setQuota(quota); } catch (BadCommandException bex) { throw new MessagingException("QUOTA not supported", bex); } catch (ConnectionException cex) { throw new StoreClosedException(this, cex.getMessage()); } catch (ProtocolException pex) { throw new MessagingException(pex.getMessage(), pex); } finally { releaseStoreProtocol(p); } }
/** * Return the unique ID string for this message, or null if * not available. Uses the POP3 UIDL command. * * @param msg the message * @return unique ID string * @exception MessagingException for failures */ public synchronized String getUID(Message msg) throws MessagingException { checkOpen(); if (!(msg instanceof POP3Message)) throw new MessagingException("message is not a POP3Message"); POP3Message m = (POP3Message)msg; try { if (!store.supportsUidl) return null; if (m.uid == POP3Message.UNKNOWN) m.uid = port.uidl(m.getMessageNumber()); return m.uid; } catch (EOFException eex) { close(false); throw new FolderClosedException(this, eex.toString()); } catch (IOException ex) { throw new MessagingException("error getting UIDL", ex); } }
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); }
/** * Set the quotas for the quota root specified in the quota argument. * Typically this will be one of the quota roots obtained from the * <code>getQuota</code> method, but it need not be. * * @param quota the quota to set * @exception MessagingException if the server doesn't support the * QUOTA extension */ @Override public synchronized void setQuota(Quota quota) throws MessagingException { checkConnected(); IMAPProtocol p = null; try { p = getStoreProtocol(); p.setQuota(quota); } catch (BadCommandException bex) { throw new MessagingException("QUOTA not supported", bex); } catch (ConnectionException cex) { throw new StoreClosedException(this, cex.getMessage()); } catch (ProtocolException pex) { throw new MessagingException(pex.getMessage(), pex); } finally { releaseStoreProtocol(p); } }
/** * Return the unique ID string for this message, or null if * not available. Uses the POP3 UIDL command. * * @param msg the message * @return unique ID string * @exception MessagingException for failures */ public synchronized String getUID(Message msg) throws MessagingException { checkOpen(); if (!(msg instanceof POP3Message)) throw new MessagingException("message is not a POP3Message"); POP3Message m = (POP3Message)msg; try { if (!store.supportsUidl) return null; if (m.uid == POP3Message.UNKNOWN) m.uid = port.uidl(m.getMessageNumber()); return m.uid; } catch (EOFException eex) { close(false); throw new FolderClosedException(this, eex.toString()); } catch (IOException ex) { throw new MessagingException("error getting UIDL", ex); } }
public Object doOptionalCommand(String err, ProtocolCommand cmd) throws MessagingException { try { return doProtocolCommand(cmd); } catch (BadCommandException bex) { throw new MessagingException(err, bex); } catch (ConnectionException cex) { // Oops, the store or folder died on us. throwClosedException(cex); } catch (ProtocolException pex) { throw new MessagingException(pex.getMessage(), pex); } return null; }
throw new FolderClosedException(this, cex.getMessage()); } catch (ProtocolException pex) { throw new MessagingException(pex.getMessage(), pex);
serverParams = p.id(clientParams); } catch (BadCommandException bex) { throw new MessagingException("ID not supported", bex); } catch (ConnectionException cex) { throw new StoreClosedException(this, cex.getMessage()); } catch (ProtocolException pex) { throw new MessagingException(pex.getMessage(), pex); } finally { releaseStoreProtocol(p);
/** * Fetch the header of the message and the first <code>n</code> lines * of the raw content of the message. The headers and data are * available in the returned InputStream. * * @param n number of lines of content to fetch * @return InputStream containing the message headers and n content lines * @exception MessagingException for failures */ public InputStream top(int n) throws MessagingException { try { synchronized (this) { return folder.getProtocol().top(msgnum, n); } } catch (EOFException eex) { folder.close(false); throw new FolderClosedException(folder, eex.toString()); } catch (IOException ex) { throw new MessagingException("error getting size", ex); } }
public Object doCommandIgnoreFailure(ProtocolCommand cmd) throws MessagingException { try { return doProtocolCommand(cmd); } catch (CommandFailedException cfx) { return null; } catch (ConnectionException cex) { // Oops, the store or folder died on us. throwClosedException(cex); } catch (ProtocolException pex) { throw new MessagingException(pex.getMessage(), pex); } return null; }
throw new FolderClosedException(this, cex.getMessage()); } catch (ProtocolException pex) { throw new MessagingException(pex.getMessage(), pex);
serverParams = p.id(clientParams); } catch (BadCommandException bex) { throw new MessagingException("ID not supported", bex); } catch (ConnectionException cex) { throw new StoreClosedException(this, cex.getMessage()); } catch (ProtocolException pex) { throw new MessagingException(pex.getMessage(), pex); } finally { releaseStoreProtocol(p);
/** * Fetch the header of the message and the first <code>n</code> lines * of the raw content of the message. The headers and data are * available in the returned InputStream. * * @param n number of lines of content to fetch * @return InputStream containing the message headers and n content lines * @exception MessagingException for failures */ public InputStream top(int n) throws MessagingException { try { synchronized (this) { return folder.getProtocol().top(msgnum, n); } } catch (EOFException eex) { folder.close(false); throw new FolderClosedException(folder, eex.toString()); } catch (IOException ex) { throw new MessagingException("error getting size", ex); } }
public Object doCommandIgnoreFailure(ProtocolCommand cmd) throws MessagingException { try { return doProtocolCommand(cmd); } catch (CommandFailedException cfx) { return null; } catch (ConnectionException cex) { // Oops, the store or folder died on us. throwClosedException(cex); } catch (ProtocolException pex) { throw new MessagingException(pex.getMessage(), pex); } return null; }
throw new FolderClosedException(this, cex.getMessage()); } catch (ProtocolException pex) { throw new MessagingException(pex.getMessage(), pex);
qa = p.getQuotaRoot(root); } catch (BadCommandException bex) { throw new MessagingException("QUOTA not supported", bex); } catch (ConnectionException cex) { throw new StoreClosedException(this, cex.getMessage()); } catch (ProtocolException pex) { throw new MessagingException(pex.getMessage(), pex); } finally { releaseStoreProtocol(p);
throw new FolderClosedException(folder, eex.toString()); } catch (IOException ex) { throw new MessagingException("error loading POP3 headers", ex);
/** * Returns the UIDValidity for this folder. */ @Override public synchronized long getUIDValidity() throws MessagingException { if (opened) // we already have this information return uidvalidity; IMAPProtocol p = null; Status status = null; try { p = getStoreProtocol(); // XXX String[] item = { "UIDVALIDITY" }; status = p.status(fullName, item); } catch (BadCommandException bex) { // Probably a RFC1730 server throw new MessagingException("Cannot obtain UIDValidity", bex); } catch (ConnectionException cex) { // Oops, the store or folder died on us. throwClosedException(cex); } catch (ProtocolException pex) { throw new MessagingException(pex.getMessage(), pex); } finally { releaseStoreProtocol(p); } if (status == null) throw new MessagingException("Cannot obtain UIDValidity"); return status.uidvalidity; }