Modified: james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/parser/SearchCommandParser.java URL: http://svn.apache.org/viewvc/james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/parser/SearchCommandParser.java?rev=773504&r1=773503&r2=773504&view=diff ============================================================================== --- james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/parser/SearchCommandParser.java (original) +++ james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/parser/SearchCommandParser.java Mon May 11 09:03:30 2009 @@ -40,7 +40,7 @@ import org.apache.james.imap.api.message.response.StatusResponseFactory; import org.apache.james.imap.api.message.response.StatusResponse.ResponseCode; import org.apache.james.imap.decode.ImapRequestLineReader; -import org.apache.james.imap.decode.ProtocolException; +import org.apache.james.imap.decode.DecodingException; class SearchCommandParser extends AbstractUidCommandParser { @@ -62,7 +62,7 @@ * true when this is the first token read, false otherwise */ public SearchKey searchKey(ImapRequestLineReader request, Charset charset, - boolean isFirstToken) throws ProtocolException, + boolean isFirstToken) throws DecodingException, IllegalCharsetNameException, UnsupportedCharsetException { final char next = request.nextChar(); if (next >= '0' && next <= '9' || next == '*') { @@ -81,31 +81,31 @@ case 'D': return d(request); case 'E': - throw new ProtocolException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); + throw new DecodingException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); case 'F': return f(request, charset); case 'G': - throw new ProtocolException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); + throw new DecodingException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); case 'H': return header(request, charset); case 'I': - throw new ProtocolException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); + throw new DecodingException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); case 'J': - throw new ProtocolException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); + throw new DecodingException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); case 'K': return keyword(request); case 'L': return larger(request); case 'M': - throw new ProtocolException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); + throw new DecodingException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); case 'N': return n(request, charset); case 'O': return o(request, charset); case 'P': - throw new ProtocolException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); + throw new DecodingException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); case 'Q': - throw new ProtocolException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); + throw new DecodingException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); case 'R': return recent(request); case 'S': @@ -115,13 +115,13 @@ case 'U': return u(request); default: - throw new ProtocolException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); + throw new DecodingException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); } } } private SearchKey paren(ImapRequestLineReader request, Charset charset) - throws ProtocolException { + throws DecodingException { request.consume(); List<SearchKey> keys = new ArrayList<SearchKey>(); addUntilParen(request, keys, charset); @@ -129,7 +129,7 @@ } private void addUntilParen(ImapRequestLineReader request, List<SearchKey> keys, - Charset charset) throws ProtocolException { + Charset charset) throws DecodingException { final char next = request.nextWordChar(); if (next == ')') { request.consume(); @@ -141,14 +141,14 @@ } private int consumeAndCap(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { final char next = request.consume(); final int cap = next > 'Z' ? next ^ 32 : next; return cap; } private SearchKey cc(ImapRequestLineReader request, final Charset charset) - throws ProtocolException { + throws DecodingException { final SearchKey result; nextIsSpace(request); final String value = astring(request, charset); @@ -158,7 +158,7 @@ private SearchKey c(ImapRequestLineReader request, final boolean isFirstToken, final Charset charset) - throws ProtocolException, IllegalCharsetNameException, + throws DecodingException, IllegalCharsetNameException, UnsupportedCharsetException { final int next = consumeAndCap(request); switch (next) { @@ -167,12 +167,12 @@ case 'H': return charset(request, isFirstToken); default: - throw new ProtocolException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); + throw new DecodingException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); } } private SearchKey charset(ImapRequestLineReader request, - final boolean isFirstToken) throws ProtocolException, + final boolean isFirstToken) throws DecodingException, IllegalCharsetNameException, UnsupportedCharsetException { final SearchKey result; nextIsA(request); @@ -182,7 +182,7 @@ nextIsT(request); nextIsSpace(request); if (!isFirstToken) { - throw new ProtocolException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); + throw new DecodingException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); } final String value = astring(request); final Charset charset = Charset.forName(value); @@ -191,7 +191,7 @@ return result; } - private SearchKey u(ImapRequestLineReader request) throws ProtocolException { + private SearchKey u(ImapRequestLineReader request) throws DecodingException { final int next = consumeAndCap(request); switch (next) { case 'I': @@ -199,12 +199,12 @@ case 'N': return un(request); default: - throw new ProtocolException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); + throw new DecodingException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); } } private SearchKey un(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { final int next = consumeAndCap(request); switch (next) { case 'A': @@ -218,12 +218,12 @@ case 'S': return unseen(request); default: - throw new ProtocolException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); + throw new DecodingException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); } } private SearchKey und(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { final int next = consumeAndCap(request); switch (next) { case 'E': @@ -231,12 +231,12 @@ case 'R': return undraft(request); default: - throw new ProtocolException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); + throw new DecodingException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); } } private SearchKey t(ImapRequestLineReader request, final Charset charset) - throws ProtocolException { + throws DecodingException { final int next = consumeAndCap(request); switch (next) { case 'E': @@ -244,12 +244,12 @@ case 'O': return to(request, charset); default: - throw new ProtocolException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); + throw new DecodingException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); } } private SearchKey s(ImapRequestLineReader request, final Charset charset) - throws ProtocolException { + throws DecodingException { final int next = consumeAndCap(request); switch (next) { case 'E': @@ -261,12 +261,12 @@ case 'U': return subject(request, charset); default: - throw new ProtocolException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); + throw new DecodingException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); } } private SearchKey se(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { final int next = consumeAndCap(request); switch (next) { case 'E': @@ -274,23 +274,23 @@ case 'N': return sen(request); default: - throw new ProtocolException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); + throw new DecodingException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); } } private SearchKey sen(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { final int next = consumeAndCap(request); switch (next) { case 'T': return sent(request); default: - throw new ProtocolException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); + throw new DecodingException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); } } private SearchKey sent(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { final int next = consumeAndCap(request); switch (next) { case 'B': @@ -300,12 +300,12 @@ case 'S': return sentSince(request); default: - throw new ProtocolException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); + throw new DecodingException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); } } private SearchKey o(ImapRequestLineReader request, Charset charset) - throws ProtocolException { + throws DecodingException { final int next = consumeAndCap(request); switch (next) { case 'L': @@ -315,12 +315,12 @@ case 'R': return or(request, charset); default: - throw new ProtocolException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); + throw new DecodingException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); } } private SearchKey n(ImapRequestLineReader request, Charset charset) - throws ProtocolException { + throws DecodingException { final int next = consumeAndCap(request); switch (next) { case 'E': @@ -328,12 +328,12 @@ case 'O': return not(request, charset); default: - throw new ProtocolException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); + throw new DecodingException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); } } private SearchKey f(ImapRequestLineReader request, final Charset charset) - throws ProtocolException { + throws DecodingException { final int next = consumeAndCap(request); switch (next) { case 'L': @@ -341,11 +341,11 @@ case 'R': return from(request, charset); default: - throw new ProtocolException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); + throw new DecodingException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); } } - private SearchKey d(ImapRequestLineReader request) throws ProtocolException { + private SearchKey d(ImapRequestLineReader request) throws DecodingException { final int next = consumeAndCap(request); switch (next) { case 'E': @@ -353,12 +353,12 @@ case 'R': return draft(request); default: - throw new ProtocolException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); + throw new DecodingException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); } } private SearchKey keyword(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { final SearchKey result; nextIsE(request); nextIsY(request); @@ -373,7 +373,7 @@ } private SearchKey unkeyword(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { final SearchKey result; nextIsE(request); nextIsY(request); @@ -388,7 +388,7 @@ } private SearchKey header(ImapRequestLineReader request, - final Charset charset) throws ProtocolException { + final Charset charset) throws DecodingException { final SearchKey result; nextIsE(request); nextIsA(request); @@ -404,7 +404,7 @@ } private SearchKey larger(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { final SearchKey result; nextIsA(request); nextIsR(request); @@ -418,7 +418,7 @@ } private SearchKey smaller(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { final SearchKey result; nextIsA(request); nextIsL(request); @@ -432,7 +432,7 @@ } private SearchKey from(ImapRequestLineReader request, final Charset charset) - throws ProtocolException { + throws DecodingException { final SearchKey result; nextIsO(request); nextIsM(request); @@ -443,7 +443,7 @@ } private SearchKey flagged(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { final SearchKey result; nextIsA(request); nextIsG(request); @@ -455,7 +455,7 @@ } private SearchKey unseen(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { final SearchKey result; nextIsE(request); nextIsE(request); @@ -465,7 +465,7 @@ } private SearchKey undraft(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { final SearchKey result; nextIsA(request); nextIsF(request); @@ -475,7 +475,7 @@ } private SearchKey undeleted(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { final SearchKey result; nextIsL(request); nextIsE(request); @@ -487,7 +487,7 @@ } private SearchKey unflagged(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { final SearchKey result; nextIsL(request); nextIsA(request); @@ -500,7 +500,7 @@ } private SearchKey unanswered(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { final SearchKey result; nextIsN(request); nextIsS(request); @@ -514,7 +514,7 @@ } private SearchKey old(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { final SearchKey result; nextIsD(request); result = SearchKey.buildOld(); @@ -522,7 +522,7 @@ } private SearchKey or(ImapRequestLineReader request, Charset charset) - throws ProtocolException { + throws DecodingException { final SearchKey result; nextIsSpace(request); final SearchKey firstKey = searchKey(request, charset, false); @@ -533,7 +533,7 @@ } private SearchKey not(ImapRequestLineReader request, Charset charset) - throws ProtocolException { + throws DecodingException { final SearchKey result; nextIsT(request); nextIsSpace(request); @@ -543,7 +543,7 @@ } private SearchKey _new(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { final SearchKey result; nextIsW(request); result = SearchKey.buildNew(); @@ -551,7 +551,7 @@ } private SearchKey recent(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { final SearchKey result; nextIsE(request); nextIsC(request); @@ -563,7 +563,7 @@ } private SearchKey seen(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { final SearchKey result; nextIsN(request); result = SearchKey.buildSeen(); @@ -571,7 +571,7 @@ } private SearchKey draft(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { final SearchKey result; nextIsA(request); nextIsF(request); @@ -581,7 +581,7 @@ } private SearchKey deleted(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { final SearchKey result; nextIsL(request); nextIsE(request); @@ -593,7 +593,7 @@ } private SearchKey b(ImapRequestLineReader request, Charset charset) - throws ProtocolException { + throws DecodingException { final int next = consumeAndCap(request); switch (next) { case 'C': @@ -603,12 +603,12 @@ case 'O': return body(request, charset); default: - throw new ProtocolException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); + throw new DecodingException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); } } private SearchKey body(ImapRequestLineReader request, final Charset charset) - throws ProtocolException { + throws DecodingException { final SearchKey result; nextIsD(request); nextIsY(request); @@ -619,7 +619,7 @@ } private SearchKey on(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { final SearchKey result; nextIsSpace(request); final DayMonthYear value = date(request); @@ -628,7 +628,7 @@ } private SearchKey sentBefore(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { final SearchKey result; nextIsE(request); nextIsF(request); @@ -642,7 +642,7 @@ } private SearchKey sentSince(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { final SearchKey result; nextIsI(request); nextIsN(request); @@ -655,7 +655,7 @@ } private SearchKey since(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { final SearchKey result; nextIsN(request); nextIsC(request); @@ -667,7 +667,7 @@ } private SearchKey sentOn(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { final SearchKey result; nextIsN(request); nextIsSpace(request); @@ -677,7 +677,7 @@ } private SearchKey before(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { final SearchKey result; nextIsF(request); nextIsO(request); @@ -690,7 +690,7 @@ } private SearchKey bcc(ImapRequestLineReader request, Charset charset) - throws ProtocolException { + throws DecodingException { final SearchKey result; nextIsC(request); nextIsSpace(request); @@ -700,7 +700,7 @@ } private SearchKey text(ImapRequestLineReader request, final Charset charset) - throws ProtocolException { + throws DecodingException { final SearchKey result; nextIsX(request); nextIsT(request); @@ -711,7 +711,7 @@ } private SearchKey uid(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { final SearchKey result; nextIsD(request); nextIsSpace(request); @@ -721,14 +721,14 @@ } private SearchKey sequenceSet(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { final IdRange[] range = parseIdRange(request); final SearchKey result = SearchKey.buildSequenceSet(range); return result; } private SearchKey to(ImapRequestLineReader request, final Charset charset) - throws ProtocolException { + throws DecodingException { final SearchKey result; nextIsSpace(request); final String value = astring(request, charset); @@ -737,7 +737,7 @@ } private SearchKey subject(ImapRequestLineReader request, - final Charset charset) throws ProtocolException { + final Charset charset) throws DecodingException { final SearchKey result; nextIsB(request); nextIsJ(request); @@ -750,7 +750,7 @@ return result; } - private SearchKey a(ImapRequestLineReader request) throws ProtocolException { + private SearchKey a(ImapRequestLineReader request) throws DecodingException { final int next = consumeAndCap(request); switch (next) { case 'L': @@ -758,12 +758,12 @@ case 'N': return answered(request); default: - throw new ProtocolException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); + throw new DecodingException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); } } private SearchKey answered(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { final SearchKey result; nextIsS(request); nextIsW(request); @@ -776,7 +776,7 @@ } private SearchKey all(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { final SearchKey result; nextIsL(request); result = SearchKey.buildAll(); @@ -784,118 +784,118 @@ } private void nextIsSpace(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { final char next = request.consume(); if (next != ' ') { - throw new ProtocolException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); + throw new DecodingException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); } } private void nextIsG(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { nextIs(request, 'G', 'g'); } private void nextIsM(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { nextIs(request, 'M', 'm'); } private void nextIsI(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { nextIs(request, 'I', 'i'); } private void nextIsN(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { nextIs(request, 'N', 'n'); } private void nextIsA(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { nextIs(request, 'A', 'a'); } private void nextIsT(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { nextIs(request, 'T', 't'); } private void nextIsY(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { nextIs(request, 'Y', 'y'); } private void nextIsX(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { nextIs(request, 'X', 'x'); } private void nextIsO(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { nextIs(request, 'O', 'o'); } private void nextIsF(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { nextIs(request, 'F', 'f'); } private void nextIsJ(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { nextIs(request, 'J', 'j'); } private void nextIsC(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { nextIs(request, 'C', 'c'); } private void nextIsD(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { nextIs(request, 'D', 'd'); } private void nextIsB(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { nextIs(request, 'B', 'b'); } private void nextIsR(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { nextIs(request, 'R', 'r'); } private void nextIsE(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { nextIs(request, 'E', 'e'); } private void nextIsW(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { nextIs(request, 'W', 'w'); } private void nextIsS(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { nextIs(request, 'S', 's'); } private void nextIsL(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { nextIs(request, 'L', 'l'); } private void nextIs(ImapRequestLineReader request, final char upper, - final char lower) throws ProtocolException { + final char lower) throws DecodingException { final char next = request.consume(); if (next != upper && next != lower) { - throw new ProtocolException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); + throw new DecodingException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown search key"); } } public SearchKey decode(ImapRequestLineReader request) - throws ProtocolException, IllegalCharsetNameException, + throws DecodingException, IllegalCharsetNameException, UnsupportedCharsetException { request.nextWordChar(); final SearchKey firstKey = searchKey(request, null, true); @@ -941,7 +941,7 @@ protected ImapMessage decode(ImapCommand command, ImapRequestLineReader request, String tag, boolean useUids, Log logger) - throws ProtocolException { + throws DecodingException { try { // Parse the search term from the request final SearchKey key = decode(request);
Modified: james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/parser/SelectCommandParser.java URL: http://svn.apache.org/viewvc/james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/parser/SelectCommandParser.java?rev=773504&r1=773503&r2=773504&view=diff ============================================================================== --- james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/parser/SelectCommandParser.java (original) +++ james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/parser/SelectCommandParser.java Mon May 11 09:03:30 2009 @@ -23,7 +23,7 @@ import org.apache.james.imap.api.ImapConstants; import org.apache.james.imap.api.ImapMessage; import org.apache.james.imap.decode.ImapRequestLineReader; -import org.apache.james.imap.decode.ProtocolException; +import org.apache.james.imap.decode.DecodingException; import org.apache.james.imap.decode.base.AbstractImapCommandParser; class SelectCommandParser extends AbstractImapCommandParser { @@ -33,7 +33,7 @@ } protected ImapMessage decode(ImapCommand command, - ImapRequestLineReader request, String tag, Log logger) throws ProtocolException { + ImapRequestLineReader request, String tag, Log logger) throws DecodingException { final String mailboxName = mailbox(request); endLine(request); final ImapMessage result = getMessageFactory().createSelectMessage( Modified: james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/parser/StatusCommandParser.java URL: http://svn.apache.org/viewvc/james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/parser/StatusCommandParser.java?rev=773504&r1=773503&r2=773504&view=diff ============================================================================== --- james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/parser/StatusCommandParser.java (original) +++ james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/parser/StatusCommandParser.java Mon May 11 09:03:30 2009 @@ -26,7 +26,7 @@ import org.apache.james.imap.api.display.HumanReadableTextKey; import org.apache.james.imap.api.message.StatusDataItems; import org.apache.james.imap.decode.ImapRequestLineReader; -import org.apache.james.imap.decode.ProtocolException; +import org.apache.james.imap.decode.DecodingException; import org.apache.james.imap.decode.base.AbstractImapCommandParser; class StatusCommandParser extends AbstractImapCommandParser { @@ -36,7 +36,7 @@ } StatusDataItems statusDataItems(ImapRequestLineReader request) - throws ProtocolException { + throws DecodingException { StatusDataItems items = new StatusDataItems(); request.nextWordChar(); @@ -56,7 +56,7 @@ } private void addItem(String nextWord, StatusDataItems items) - throws ProtocolException { + throws DecodingException { if (nextWord.equals(ImapConstants.STATUS_MESSAGES)) { items.setMessages(true); } else if (nextWord.equals(ImapConstants.STATUS_RECENT)) { @@ -68,13 +68,13 @@ } else if (nextWord.equals(ImapConstants.STATUS_UNSEEN)) { items.setUnseen(true); } else { - throw new ProtocolException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, + throw new DecodingException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Unknown status item: '" + nextWord + "'"); } } protected ImapMessage decode(ImapCommand command, - ImapRequestLineReader request, String tag, Log logger) throws ProtocolException { + ImapRequestLineReader request, String tag, Log logger) throws DecodingException { final String mailboxName = mailbox(request); final StatusDataItems statusDataItems = statusDataItems(request); endLine(request); Modified: james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/parser/StoreCommandParser.java URL: http://svn.apache.org/viewvc/james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/parser/StoreCommandParser.java?rev=773504&r1=773503&r2=773504&view=diff ============================================================================== --- james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/parser/StoreCommandParser.java (original) +++ james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/parser/StoreCommandParser.java Mon May 11 09:03:30 2009 @@ -27,7 +27,7 @@ import org.apache.james.imap.api.display.HumanReadableTextKey; import org.apache.james.imap.api.message.IdRange; import org.apache.james.imap.decode.ImapRequestLineReader; -import org.apache.james.imap.decode.ProtocolException; +import org.apache.james.imap.decode.DecodingException; class StoreCommandParser extends AbstractUidCommandParser { @@ -37,7 +37,7 @@ protected ImapMessage decode(ImapCommand command, ImapRequestLineReader request, String tag, boolean useUids, Log logger) - throws ProtocolException { + throws DecodingException { final IdRange[] idSet = parseIdRange(request); final Boolean sign; boolean silent = false; @@ -59,7 +59,7 @@ } else if ("FLAGS.SILENT".equalsIgnoreCase(directive)) { silent = true; } else { - throw new ProtocolException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, + throw new DecodingException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Invalid Store Directive: '" + directive + "'"); } Modified: james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/parser/SubscribeCommandParser.java URL: http://svn.apache.org/viewvc/james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/parser/SubscribeCommandParser.java?rev=773504&r1=773503&r2=773504&view=diff ============================================================================== --- james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/parser/SubscribeCommandParser.java (original) +++ james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/parser/SubscribeCommandParser.java Mon May 11 09:03:30 2009 @@ -23,7 +23,7 @@ import org.apache.james.imap.api.ImapConstants; import org.apache.james.imap.api.ImapMessage; import org.apache.james.imap.decode.ImapRequestLineReader; -import org.apache.james.imap.decode.ProtocolException; +import org.apache.james.imap.decode.DecodingException; import org.apache.james.imap.decode.base.AbstractImapCommandParser; class SubscribeCommandParser extends AbstractImapCommandParser { @@ -33,7 +33,7 @@ } protected ImapMessage decode(ImapCommand command, - ImapRequestLineReader request, String tag, Log logger) throws ProtocolException { + ImapRequestLineReader request, String tag, Log logger) throws DecodingException { final String mailboxName = mailbox(request); endLine(request); Modified: james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/parser/UidCommandParser.java URL: http://svn.apache.org/viewvc/james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/parser/UidCommandParser.java?rev=773504&r1=773503&r2=773504&view=diff ============================================================================== --- james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/parser/UidCommandParser.java (original) +++ james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/parser/UidCommandParser.java Mon May 11 09:03:30 2009 @@ -27,7 +27,7 @@ import org.apache.james.imap.decode.ImapCommandParser; import org.apache.james.imap.decode.ImapCommandParserFactory; import org.apache.james.imap.decode.ImapRequestLineReader; -import org.apache.james.imap.decode.ProtocolException; +import org.apache.james.imap.decode.DecodingException; import org.apache.james.imap.decode.base.AbstractImapCommandParser; class UidCommandParser extends AbstractImapCommandParser implements @@ -54,7 +54,7 @@ } protected ImapMessage decode(ImapCommand command, - ImapRequestLineReader request, String tag, Log logger) throws ProtocolException { + ImapRequestLineReader request, String tag, Log logger) throws DecodingException { // TODO: check the logic against the specification: // TODO: suspect that it is now bust // TODO: the command written may be wrong @@ -65,7 +65,7 @@ // TODO: replace abstract class with interface if (helperCommand == null || !(helperCommand instanceof AbstractUidCommandParser)) { - throw new ProtocolException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, + throw new DecodingException(HumanReadableTextKey.ILLEGAL_ARGUMENTS, "Invalid UID command: '" + commandName + "'"); } final AbstractUidCommandParser uidEnabled = (AbstractUidCommandParser) helperCommand; Modified: james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/parser/UnsubscribeCommandParser.java URL: http://svn.apache.org/viewvc/james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/parser/UnsubscribeCommandParser.java?rev=773504&r1=773503&r2=773504&view=diff ============================================================================== --- james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/parser/UnsubscribeCommandParser.java (original) +++ james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/parser/UnsubscribeCommandParser.java Mon May 11 09:03:30 2009 @@ -23,7 +23,7 @@ import org.apache.james.imap.api.ImapConstants; import org.apache.james.imap.api.ImapMessage; import org.apache.james.imap.decode.ImapRequestLineReader; -import org.apache.james.imap.decode.ProtocolException; +import org.apache.james.imap.decode.DecodingException; import org.apache.james.imap.decode.base.AbstractImapCommandParser; class UnsubscribeCommandParser extends AbstractImapCommandParser { @@ -33,7 +33,7 @@ } protected ImapMessage decode(ImapCommand command, - ImapRequestLineReader request, String tag, Log logger) throws ProtocolException { + ImapRequestLineReader request, String tag, Log logger) throws DecodingException { final String mailboxName = mailbox(request); endLine(request); final ImapMessage result = getMessageFactory() Modified: james/imap/trunk/decode/src/test/java/org/apache/james/imap/decode/DecoderUtilsTest.java URL: http://svn.apache.org/viewvc/james/imap/trunk/decode/src/test/java/org/apache/james/imap/decode/DecoderUtilsTest.java?rev=773504&r1=773503&r2=773504&view=diff ============================================================================== --- james/imap/trunk/decode/src/test/java/org/apache/james/imap/decode/DecoderUtilsTest.java (original) +++ james/imap/trunk/decode/src/test/java/org/apache/james/imap/decode/DecoderUtilsTest.java Mon May 11 09:03:30 2009 @@ -104,7 +104,7 @@ try { DecoderUtils.decodeDateTime(datetime); fail("Bad date-time" + datetime); - } catch (ProtocolException e) { + } catch (DecodingException e) { // expected } } @@ -271,14 +271,14 @@ try { DecoderUtils.decodeDigit('/'); fail("/ is not a digit"); - } catch (ProtocolException e) { + } catch (DecodingException e) { // expected } try { DecoderUtils.decodeDigit(':'); fail(": is not a digit"); - } catch (ProtocolException e) { + } catch (DecodingException e) { // expected } } @@ -324,7 +324,7 @@ try { DecoderUtils.decodeMonth(one, two, three); fail(one + two + three + "is not a month"); - } catch (ProtocolException e) { + } catch (DecodingException e) { // expected } } @@ -354,7 +354,7 @@ try { DecoderUtils.decodeYear(one, two, three, four); fail(one + two + three + four + "is not a month"); - } catch (ProtocolException e) { + } catch (DecodingException e) { // expected } } @@ -434,7 +434,7 @@ DecoderUtils.decodeZone(zone.charAt(0), zone.charAt(1), zone .charAt(2), zone.charAt(3), zone.charAt(4)); fail(zone + "is not a timezone"); - } catch (ProtocolException e) { + } catch (DecodingException e) { // expected } } @@ -497,7 +497,7 @@ try { DecoderUtils.decodeNumber(number.charAt(0), number.charAt(1)); fail(number + "is not a number"); - } catch (ProtocolException e) { + } catch (DecodingException e) { // expected } } Modified: james/imap/trunk/decode/src/test/java/org/apache/james/imap/decode/FetchPartPathDecoderTest.java URL: http://svn.apache.org/viewvc/james/imap/trunk/decode/src/test/java/org/apache/james/imap/decode/FetchPartPathDecoderTest.java?rev=773504&r1=773503&r2=773504&view=diff ============================================================================== --- james/imap/trunk/decode/src/test/java/org/apache/james/imap/decode/FetchPartPathDecoderTest.java (original) +++ james/imap/trunk/decode/src/test/java/org/apache/james/imap/decode/FetchPartPathDecoderTest.java Mon May 11 09:03:30 2009 @@ -120,7 +120,7 @@ try { decoder.decode("1.34.BOGUS"); fail("Expected protocol exception to be thrown"); - } catch (ProtocolException e) { + } catch (DecodingException e) { // expected } } @@ -130,7 +130,7 @@ try { decoder.decode("1.34.BOGUS.44.34234.324"); fail("Expected protocol exception to be thrown"); - } catch (ProtocolException e) { + } catch (DecodingException e) { // expected } } Modified: james/imap/trunk/decode/src/test/java/org/apache/james/imap/decode/parser/FetchCommandParserPartialFetchTest.java URL: http://svn.apache.org/viewvc/james/imap/trunk/decode/src/test/java/org/apache/james/imap/decode/parser/FetchCommandParserPartialFetchTest.java?rev=773504&r1=773503&r2=773504&view=diff ============================================================================== --- james/imap/trunk/decode/src/test/java/org/apache/james/imap/decode/parser/FetchCommandParserPartialFetchTest.java (original) +++ james/imap/trunk/decode/src/test/java/org/apache/james/imap/decode/parser/FetchCommandParserPartialFetchTest.java Mon May 11 09:03:30 2009 @@ -29,7 +29,7 @@ import org.apache.james.imap.api.message.FetchData; import org.apache.james.imap.api.message.IdRange; import org.apache.james.imap.decode.ImapRequestLineReader; -import org.apache.james.imap.decode.ProtocolException; +import org.apache.james.imap.decode.DecodingException; import org.apache.james.imap.decode.parser.FetchCommandParser; import org.jmock.Expectations; import org.jmock.integration.junit3.MockObjectTestCase; @@ -79,7 +79,7 @@ .getBytes("US-ASCII")), new ByteArrayOutputStream()); parser.decode(command, reader, "A01", false, new MockLogger()); fail("Number of octets must be non-zero"); - } catch (ProtocolException e) { + } catch (DecodingException e) { // expected } } Modified: james/imap/trunk/decode/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserAndParenthesesTest.java URL: http://svn.apache.org/viewvc/james/imap/trunk/decode/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserAndParenthesesTest.java?rev=773504&r1=773503&r2=773504&view=diff ============================================================================== --- james/imap/trunk/decode/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserAndParenthesesTest.java (original) +++ james/imap/trunk/decode/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserAndParenthesesTest.java Mon May 11 09:03:30 2009 @@ -32,7 +32,7 @@ import org.apache.james.imap.api.message.request.DayMonthYear; import org.apache.james.imap.api.message.request.SearchKey; import org.apache.james.imap.decode.ImapRequestLineReader; -import org.apache.james.imap.decode.ProtocolException; +import org.apache.james.imap.decode.DecodingException; import org.jmock.integration.junit3.MockObjectTestCase; public class SearchCommandParserAndParenthesesTest extends MockObjectTestCase { @@ -184,7 +184,7 @@ } private void check(Input in) throws UnsupportedEncodingException, - ProtocolException { + DecodingException { String input = in.input + "\r\n"; ImapRequestLineReader reader = new ImapRequestLineReader( new ByteArrayInputStream(input.getBytes("US-ASCII")), Modified: james/imap/trunk/decode/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserQuotedCharsetTest.java URL: http://svn.apache.org/viewvc/james/imap/trunk/decode/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserQuotedCharsetTest.java?rev=773504&r1=773503&r2=773504&view=diff ============================================================================== --- james/imap/trunk/decode/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserQuotedCharsetTest.java (original) +++ james/imap/trunk/decode/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserQuotedCharsetTest.java Mon May 11 09:03:30 2009 @@ -35,7 +35,7 @@ import org.apache.james.imap.api.message.response.StatusResponse; import org.apache.james.imap.api.message.response.StatusResponseFactory; import org.apache.james.imap.decode.ImapRequestLineReader; -import org.apache.james.imap.decode.ProtocolException; +import org.apache.james.imap.decode.DecodingException; import org.jmock.Expectations; import org.jmock.integration.junit3.MockObjectTestCase; @@ -201,7 +201,7 @@ new ByteArrayOutputStream()); parser.decode(command, reader, TAG, false, new MockLogger()); fail("A protocol exception should be thrown when charset is incompatible with input"); - } catch (ProtocolException e) { + } catch (DecodingException e) { // expected } } Modified: james/imap/trunk/decode/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserSearchKeyTest.java URL: http://svn.apache.org/viewvc/james/imap/trunk/decode/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserSearchKeyTest.java?rev=773504&r1=773503&r2=773504&view=diff ============================================================================== --- james/imap/trunk/decode/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserSearchKeyTest.java (original) +++ james/imap/trunk/decode/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserSearchKeyTest.java Mon May 11 09:03:30 2009 @@ -29,7 +29,7 @@ import org.apache.james.imap.api.message.request.DayMonthYear; import org.apache.james.imap.api.message.request.SearchKey; import org.apache.james.imap.decode.ImapRequestLineReader; -import org.apache.james.imap.decode.ProtocolException; +import org.apache.james.imap.decode.DecodingException; import org.jmock.integration.junit3.MockObjectTestCase; public class SearchCommandParserSearchKeyTest extends MockObjectTestCase { @@ -689,7 +689,7 @@ try { parser.searchKey(reader, null, false); fail("Expected protocol exception to be throw since input is invalid"); - } catch (ProtocolException e) { + } catch (DecodingException e) { // expected } } Modified: james/imap/trunk/decode/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserTopLevelAndTest.java URL: http://svn.apache.org/viewvc/james/imap/trunk/decode/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserTopLevelAndTest.java?rev=773504&r1=773503&r2=773504&view=diff ============================================================================== --- james/imap/trunk/decode/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserTopLevelAndTest.java (original) +++ james/imap/trunk/decode/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserTopLevelAndTest.java Mon May 11 09:03:30 2009 @@ -32,7 +32,7 @@ import org.apache.james.imap.api.message.request.DayMonthYear; import org.apache.james.imap.api.message.request.SearchKey; import org.apache.james.imap.decode.ImapRequestLineReader; -import org.apache.james.imap.decode.ProtocolException; +import org.apache.james.imap.decode.DecodingException; import org.jmock.integration.junit3.MockObjectTestCase; public class SearchCommandParserTopLevelAndTest extends MockObjectTestCase { @@ -184,7 +184,7 @@ } private void check(List<SearchKey> keys, StringBuffer buffer) - throws UnsupportedEncodingException, ProtocolException { + throws UnsupportedEncodingException, DecodingException { buffer.append("\r\n"); String input = buffer.toString(); SearchKey key = SearchKey.buildAnd(keys); Modified: james/imap/trunk/seda/src/main/java/org/apache/james/imap/main/ImapRequestHandler.java URL: http://svn.apache.org/viewvc/james/imap/trunk/seda/src/main/java/org/apache/james/imap/main/ImapRequestHandler.java?rev=773504&r1=773503&r2=773504&view=diff ============================================================================== --- james/imap/trunk/seda/src/main/java/org/apache/james/imap/main/ImapRequestHandler.java (original) +++ james/imap/trunk/seda/src/main/java/org/apache/james/imap/main/ImapRequestHandler.java Mon May 11 09:03:30 2009 @@ -33,7 +33,7 @@ import org.apache.james.imap.api.process.ImapProcessor.Responder; import org.apache.james.imap.decode.ImapDecoder; import org.apache.james.imap.decode.ImapRequestLineReader; -import org.apache.james.imap.decode.ProtocolException; +import org.apache.james.imap.decode.DecodingException; import org.apache.james.imap.encode.ImapEncoder; import org.apache.james.imap.encode.ImapResponseComposer; import org.apache.james.imap.encode.base.ImapResponseComposerImpl; @@ -88,7 +88,7 @@ final Log logger = session.getLog(); try { request.nextChar(); - } catch (ProtocolException e) { + } catch (DecodingException e) { logger.debug("Unexpected end of line. Cannot handle request: ", e); abandon(output, session); @@ -105,7 +105,7 @@ // This allows us // to clean up after a protocol error. request.consumeLine(); - } catch (ProtocolException e) { + } catch (DecodingException e) { // Cannot clean up. No recovery is therefore possible. // Abandon connection. if (logger.isInfoEnabled()) { --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
