Package com.icegreen.greenmail.imap

Examples of com.icegreen.greenmail.imap.ProtocolException


            throws ProtocolException, FolderException {
        String commandName = parser.atom(request);
        ImapCommand command = commandFactory.getCommand(commandName);
        if (command == null ||
                !(command instanceof UidEnabledCommand)) {
            throw new ProtocolException("Invalid UID command: '" + commandName + "'");
        }

        ((UidEnabledCommand) command).doProcess(request, response, session, true);
    }
View Full Code Here


            String mailString = consumeLiteral(request);

            try {
                return GreenMailUtil.instance().newMimeMessage(mailString);
            } catch (Exception e) {
                throw new ProtocolException("UnexpectedException: " + e.getMessage());
            }
        }
View Full Code Here

            } else if (nextWord.equals(UIDVALIDITY)) {
                items.uidValidity = true;
            } else if (nextWord.equals(UNSEEN)) {
                items.unseen = true;
            } else {
                throw new ProtocolException("Unknown status item: '" + nextWord + "'");
            }
        }
View Full Code Here

            default:
                String value = atom(request);
                if ("NIL".equals(value)) {
                    return null;
                } else {
                    throw new ProtocolException("Invalid nstring value: valid values are '\"...\"', '{12} CRLF *CHAR8', and 'NIL'.");
                }
        }
    }
View Full Code Here

        char next = request.nextWordChar();
        String dateString;
        if (next == '"') {
            dateString = consumeQuoted(request);
        } else {
            throw new ProtocolException("DateTime values must be quoted.");
        }

        DateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy hh:mm:ss zzzz");
        try {
            return dateFormat.parse(dateString);
        } catch (ParseException e) {
            throw new ProtocolException("Invalid date format.");
        }
    }
View Full Code Here

        DateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
        try {
            return dateFormat.parse(dateString);
        } catch (ParseException e) {
            throw new ProtocolException("Invalid date format.");
        }
    }
View Full Code Here

        while (!isWhitespace(next)) {
            if (validator.isValid(next)) {
                atom.append(next);
                request.consume();
            } else {
                throw new ProtocolException("Invalid character: '" + next + "'");
            }
            next = request.nextChar();
        }
        return atom.toString();
    }
View Full Code Here

     */
    protected void consumeChar(ImapRequestLineReader request, char expected)
            throws ProtocolException {
        char consumed = request.consume();
        if (consumed != expected) {
            throw new ProtocolException("Expected:'" + expected + "' found:'" + consumed + "'");
        }
    }
View Full Code Here

        while (next != '"') {
            if (next == '\\') {
                request.consume();
                next = request.nextChar();
                if (!isQuotedSpecial(next)) {
                    throw new ProtocolException("Invalid escaped character in quote: '" +
                            next + "'");
                }
            }
            quoted.append(next);
            request.consume();
View Full Code Here

        } else if (flagString.equalsIgnoreCase(MessageFlags.FLAGGED)) {
            flags.add(Flags.Flag.FLAGGED);
        } else if (flagString.equalsIgnoreCase(MessageFlags.SEEN)) {
            flags.add(Flags.Flag.SEEN);
        } else {
            throw new ProtocolException("Invalid flag string.");
        }
    }
View Full Code Here

TOP

Related Classes of com.icegreen.greenmail.imap.ProtocolException

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.