Package org.apache.james.imapserver

Examples of org.apache.james.imapserver.ProtocolException


                long highVal = parseLong( range.substring( pos + 1 ) );
                return new HighLowIdSet( lowVal, highVal );
            }
        }
        catch ( NumberFormatException e ) {
            throw new ProtocolException( "Invalid message set.");
        }
    }
View Full Code Here


                    message.getFlags().setSeen( true );
                    // TODO need to store this change.
                }
            }
            else {
                throw new ProtocolException( "Invalid fetch attribute" );
            }
        }

        return response.toString();
    }
View Full Code Here

                    }
                    if ( "RFC822.TEXT".equalsIgnoreCase( name ) ) {
                        return new BodyFetchElement( "RFC822.TEXT", "TEXT", false );
                    }
                    else {
                        throw new ProtocolException( "Invalid fetch attribute: " + name );
                    }
                }
                else {
                    consumeChar( request, '[' );

                    StringBuffer sectionIdentifier = new StringBuffer();
                    next = nextCharInLine( request );
                    while ( next != ']' ) {
                        sectionIdentifier.append( next );
                        request.consume();
                        next = nextCharInLine(request);
                    }
                    consumeChar( request, ']' );

                    String parameter = sectionIdentifier.toString();

                    if ( "BODY".equalsIgnoreCase( name ) ) {
                        return new BodyFetchElement( "BODY[" + parameter + "]", parameter, false );
                    }
                    if ( "BODY.PEEK".equalsIgnoreCase( name ) ) {
                        return new BodyFetchElement( "BODY[" + parameter + "]", parameter, true );
                    }
                    else {
                        throw new ProtocolException( "Invalid fetch attibute: " + name + "[]" );
                    }
                }
            }
View Full Code Here

        private char nextCharInLine( ImapRequestLineReader request )
                throws ProtocolException
        {
            char next = request.nextChar();
            if ( next == '\r' || next == '\n' ) {
                throw new ProtocolException( "Unexpected end of line." );
            }
            return next;
        }
View Full Code Here

            }
            else if ( "FLAGS.SILENT".equalsIgnoreCase( directive ) ) {
                silent = true;
            }
            else {
                throw new ProtocolException( "Invalid Store Directive: '" + directive + "'" );
            }
            return new StoreDirective( sign, silent );
        }
View Full Code Here

    {
        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

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

                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

        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

TOP

Related Classes of org.apache.james.imapserver.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.