@Override protected IMAPProtocol getProtocol() throws ProtocolException, FolderClosedException { return msg.getProtocol(); }
protected IMAPProtocol getProtocol() throws ProtocolException, FolderClosedException { return msg.getProtocol(); }
/** * Do a NOOP to force any untagged EXPUNGE responses * and then check if this message is expunged. * * @exception MessageRemovedException if the message has been removed * @exception FolderClosedException if the folder has been closed */ protected void forceCheckExpunged() throws MessageRemovedException, FolderClosedException { synchronized (getMessageCacheLock()) { try { getProtocol().noop(); } catch (ConnectionException cex) { throw new FolderClosedException(folder, cex.getMessage()); } catch (ProtocolException pex) { // ignore it } } if (expunged) throw new MessageRemovedException(); }
/** * Do a NOOP to force any untagged EXPUNGE responses * and then check if this message is expunged. * * @exception MessageRemovedException if the message has been removed * @exception FolderClosedException if the folder has been closed */ protected void forceCheckExpunged() throws MessageRemovedException, FolderClosedException { synchronized (getMessageCacheLock()) { try { getProtocol().noop(); } catch (ConnectionException cex) { throw new FolderClosedException(folder, cex.getMessage()); } catch (ProtocolException pex) { // ignore it } } if (expunged) throw new MessageRemovedException(); }
/** * Set/Unset the given flags in this message. */ public synchronized void setFlags(Flags flag, boolean set) throws MessagingException { // Acquire MessageCacheLock, to freeze seqnum. synchronized(getMessageCacheLock()) { try { IMAPProtocol p = getProtocol(); checkExpunged(); // Insure that this message is not expunged p.storeFlags(getSequenceNumber(), flag, set); } catch (ConnectionException cex) { throw new FolderClosedException(folder, cex.getMessage()); } catch (ProtocolException pex) { throw new MessagingException(pex.getMessage(), pex); } } }
/** * Set/Unset the given flags in this message. */ @Override public synchronized void setFlags(Flags flag, boolean set) throws MessagingException { // Acquire MessageCacheLock, to freeze seqnum. synchronized(getMessageCacheLock()) { try { IMAPProtocol p = getProtocol(); checkExpunged(); // Insure that this message is not expunged p.storeFlags(getSequenceNumber(), flag, set); } catch (ConnectionException cex) { throw new FolderClosedException(folder, cex.getMessage()); } catch (ProtocolException pex) { throw new MessagingException(pex.getMessage(), pex); } } }
/** * Return the modification sequence number (MODSEQ) for this message. * Returns -1 if not known. * * @return the modification sequence number * @exception MessagingException for failures * @see "RFC 4551" * @since JavaMail 1.5.1 */ public synchronized long getModSeq() throws MessagingException { if (modseq != -1) return modseq; synchronized (getMessageCacheLock()) { // Acquire Lock try { IMAPProtocol p = getProtocol(); checkExpunged(); // insure that message is not expunged MODSEQ ms = p.fetchMODSEQ(getSequenceNumber()); if (ms != null) modseq = ms.modseq; } catch (ConnectionException cex) { throw new FolderClosedException(folder, cex.getMessage()); } catch (ProtocolException pex) { throw new MessagingException(pex.getMessage(), pex); } } return modseq; }
/** * Return the modification sequence number (MODSEQ) for this message. * Returns -1 if not known. * * @return the modification sequence number * @exception MessagingException for failures * @see "RFC 4551" * @since JavaMail 1.5.1 */ public synchronized long getModSeq() throws MessagingException { if (modseq != -1) return modseq; synchronized (getMessageCacheLock()) { // Acquire Lock try { IMAPProtocol p = getProtocol(); checkExpunged(); // insure that message is not expunged MODSEQ ms = p.fetchMODSEQ(getSequenceNumber()); if (ms != null) modseq = ms.modseq; } catch (ConnectionException cex) { throw new FolderClosedException(folder, cex.getMessage()); } catch (ProtocolException pex) { throw new MessagingException(pex.getMessage(), pex); } } return modseq; }
/** * Do a NOOP to force any untagged EXPUNGE responses * and then check if this message is expunged. */ private void forceCheckExpunged() throws MessageRemovedIOException, FolderClosedIOException { synchronized (msg.getMessageCacheLock()) { try { msg.getProtocol().noop(); } catch (ConnectionException cex) { throw new FolderClosedIOException(msg.getFolder(), cex.getMessage()); } catch (FolderClosedException fex) { throw new FolderClosedIOException(fex.getFolder(), fex.getMessage()); } catch (ProtocolException pex) { // ignore it } } if (msg.isExpunged()) throw new MessageRemovedIOException(); }
/** * Do a NOOP to force any untagged EXPUNGE responses * and then check if this message is expunged. */ private void forceCheckExpunged() throws MessageRemovedIOException, FolderClosedIOException { synchronized (msg.getMessageCacheLock()) { try { msg.getProtocol().noop(); } catch (ConnectionException cex) { throw new FolderClosedIOException(msg.getFolder(), cex.getMessage()); } catch (FolderClosedException fex) { throw new FolderClosedIOException(fex.getFolder(), fex.getMessage()); } catch (ProtocolException pex) { // ignore it } } if (msg.isExpunged()) throw new MessageRemovedIOException(); }
private synchronized void loadFlags() throws MessagingException { if (flags != null) return; // Acquire MessageCacheLock, to freeze seqnum. synchronized(getMessageCacheLock()) { try { IMAPProtocol p = getProtocol(); // This message could be expunged when we were waiting // to acquire the lock ... checkExpunged(); flags = p.fetchFlags(getSequenceNumber()); // make sure flags is always set, even if server is broken if (flags == null) flags = new Flags(); } catch (ConnectionException cex) { throw new FolderClosedException(folder, cex.getMessage()); } catch (ProtocolException pex) { forceCheckExpunged(); throw new MessagingException(pex.getMessage(), pex); } } // Release MessageCacheLock }
private synchronized void loadFlags() throws MessagingException { if (flags != null) return; // Acquire MessageCacheLock, to freeze seqnum. synchronized(getMessageCacheLock()) { try { IMAPProtocol p = getProtocol(); // This message could be expunged when we were waiting // to acquire the lock ... checkExpunged(); flags = p.fetchFlags(getSequenceNumber()); // make sure flags is always set, even if server is broken if (flags == null) flags = new Flags(); } catch (ConnectionException cex) { throw new FolderClosedException(folder, cex.getMessage()); } catch (ProtocolException pex) { forceCheckExpunged(); throw new MessagingException(pex.getMessage(), pex); } } // Release MessageCacheLock }
private synchronized void loadBODYSTRUCTURE() throws MessagingException { if (bs != null) // already loaded return; // Acquire MessageCacheLock, to freeze seqnum. synchronized(getMessageCacheLock()) { try { IMAPProtocol p = getProtocol(); // This message could be expunged when we were waiting // to acquire the lock ... checkExpunged(); bs = p.fetchBodyStructure(getSequenceNumber()); } catch (ConnectionException cex) { throw new FolderClosedException(folder, cex.getMessage()); } catch (ProtocolException pex) { forceCheckExpunged(); throw new MessagingException(pex.getMessage(), pex); } if (bs == null) { // if the FETCH is successful, we should always get a // BODYSTRUCTURE, but some servers fail to return it // if the message has been expunged forceCheckExpunged(); throw new MessagingException("Unable to load BODYSTRUCTURE"); } } }
private synchronized void loadBODYSTRUCTURE() throws MessagingException { if (bs != null) // already loaded return; // Acquire MessageCacheLock, to freeze seqnum. synchronized(getMessageCacheLock()) { try { IMAPProtocol p = getProtocol(); // This message could be expunged when we were waiting // to acquire the lock ... checkExpunged(); bs = p.fetchBodyStructure(getSequenceNumber()); } catch (ConnectionException cex) { throw new FolderClosedException(folder, cex.getMessage()); } catch (ProtocolException pex) { forceCheckExpunged(); throw new MessagingException(pex.getMessage(), pex); } if (bs == null) { // if the FETCH is successful, we should always get a // BODYSTRUCTURE, but some servers fail to return it // if the message has been expunged forceCheckExpunged(); throw new MessagingException("Unable to load BODYSTRUCTURE"); } } }
IMAPProtocol p = message.getProtocol();
IMAPProtocol p = message.getProtocol();
IMAPProtocol p = getProtocol();
IMAPProtocol p = getProtocol();
IMAPProtocol p = getProtocol();
IMAPProtocol p = getProtocol();