Package org.apache.james.mailbox

Examples of org.apache.james.mailbox.MessageRangeException


        final SelectedMailbox selected = session.getSelected();
        final long resultUid = result.getUid();
        final int resultMsn = selected.msn(resultUid);

        if (resultMsn == SelectedMailbox.NO_SUCH_MESSAGE)
            throw new MessageRangeException("No such message found with uid " + resultUid);

        reset(resultMsn);
        // setMsn(resultMsn);

        // Check if this fetch will cause the "SEEN" flag to be set on this
View Full Code Here


            // Take care of "*" and "*:*" values by return the last message in
            // the mailbox. See IMAP-289
            if (lowVal == Long.MAX_VALUE && highVal == Long.MAX_VALUE) {
                highVal = selected.getLastUid();
                if (highVal == SelectedMailbox.NO_SUCH_MESSAGE) {
                    throw new MessageRangeException("Mailbox is empty");
                }
                return MessageRange.one(highVal);
            }

            if (lowVal != Long.MIN_VALUE) {
                lowVal = selected.uid((int) lowVal);
                if (lowVal == SelectedMailbox.NO_SUCH_MESSAGE)
                    throw new MessageRangeException("No message found with msn " + lowVal);
            } else {
                lowVal = selected.getFirstUid();
                if (lowVal == SelectedMailbox.NO_SUCH_MESSAGE) {
                    throw new MessageRangeException("Mailbox is empty");
                }
            }
            if (highVal != Long.MAX_VALUE) {
                highVal = selected.uid((int) highVal);
                if (highVal == SelectedMailbox.NO_SUCH_MESSAGE)
                    throw new MessageRangeException("No message found with msn " + highVal);
            } else {
                highVal = selected.getLastUid();
                if (highVal == SelectedMailbox.NO_SUCH_MESSAGE) {
                    throw new MessageRangeException("Mailbox is empty");
                }
            }
           
        } else {
            if (selected.existsCount() <= 0) {
View Full Code Here

            }

            end = selected.getLastUid();
            return MessageRange.range(start, end);
        default:
            throw new MessageRangeException("Unknown message range type: " + rangeType);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.james.mailbox.MessageRangeException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.