Package org.apache.james.imapserver

Examples of org.apache.james.imapserver.ProtocolException


    {
        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


                byte[] messageBytes = mailString.getBytes( "US-ASCII" );
                source = new MimeMessageByteArraySource( "Mail" + System.currentTimeMillis(),
                                                         messageBytes);
            }
            catch ( Exception e ) {
                throw new ProtocolException( "UnexpectedException: " + e.getMessage() );
            }

            return new MimeMessageWrapper( source );
        }
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

                byte[] messageBytes = mailString.getBytes( "US-ASCII" );
                source = new MimeMessageByteArraySource( "Mail" + System.currentTimeMillis(),
                                                         messageBytes);
            }
            catch ( Exception e ) {
                throw new ProtocolException( "UnexpectedException: " + e.getMessage() );
            }

            return new MimeMessageWrapper( source );
        }
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

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.