james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r1145713 - in /james/imap/trunk/message/src/main/java/org/apache/james/imap/decode: ImapRequestLineReader.java parser/AbstractSelectionCommandParser.java parser/SearchCommandParser.java parser/StoreCommandParser.java
Date Tue, 12 Jul 2011 18:38:53 GMT
Author: norman
Date: Tue Jul 12 18:38:53 2011
New Revision: 1145713

URL: http://svn.apache.org/viewvc?rev=1145713&view=rev
Log:
Move a util method to ImapRequestListReader. See IMAP-305

Modified:
    james/imap/trunk/message/src/main/java/org/apache/james/imap/decode/ImapRequestLineReader.java
    james/imap/trunk/message/src/main/java/org/apache/james/imap/decode/parser/AbstractSelectionCommandParser.java
    james/imap/trunk/message/src/main/java/org/apache/james/imap/decode/parser/SearchCommandParser.java
    james/imap/trunk/message/src/main/java/org/apache/james/imap/decode/parser/StoreCommandParser.java

Modified: james/imap/trunk/message/src/main/java/org/apache/james/imap/decode/ImapRequestLineReader.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/message/src/main/java/org/apache/james/imap/decode/ImapRequestLineReader.java?rev=1145713&r1=1145712&r2=1145713&view=diff
==============================================================================
--- james/imap/trunk/message/src/main/java/org/apache/james/imap/decode/ImapRequestLineReader.java
(original)
+++ james/imap/trunk/message/src/main/java/org/apache/james/imap/decode/ImapRequestLineReader.java
Tue Jul 12 18:38:53 2011
@@ -59,6 +59,13 @@ public abstract class ImapRequestLineRea
 
     protected char nextChar; // unknown
 
+
+
+    public static int cap(char next) {
+        final int cap = next > 'Z' ? next ^ 32 : next;
+        return cap;
+    }
+    
     /**
      * Reads the next regular, non-space character in the current line. Spaces
      * are skipped over, but end-of-line characters will cause a

Modified: james/imap/trunk/message/src/main/java/org/apache/james/imap/decode/parser/AbstractSelectionCommandParser.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/message/src/main/java/org/apache/james/imap/decode/parser/AbstractSelectionCommandParser.java?rev=1145713&r1=1145712&r2=1145713&view=diff
==============================================================================
--- james/imap/trunk/message/src/main/java/org/apache/james/imap/decode/parser/AbstractSelectionCommandParser.java
(original)
+++ james/imap/trunk/message/src/main/java/org/apache/james/imap/decode/parser/AbstractSelectionCommandParser.java
Tue Jul 12 18:38:53 2011
@@ -28,6 +28,7 @@ import org.apache.james.imap.decode.base
 import org.apache.james.imap.message.request.AbstractMailboxSelectionRequest;
 
 public abstract class AbstractSelectionCommandParser extends AbstractImapCommandParser{
+    private final static byte[] CONDSTORE = "(CONDSTORE)".getBytes();
 
     public AbstractSelectionCommandParser(ImapCommand command) {
         super(command);
@@ -35,12 +36,6 @@ public abstract class AbstractSelectionC
     
 
 
-    private final static byte[] CONDSTORE = "(CONDSTORE)".getBytes();
-
-    private int cap(char next) {
-        final int cap = next > 'Z' ? next ^ 32 : next;
-        return cap;
-    }
     
     /*
      * (non-Javadoc)
@@ -66,7 +61,7 @@ public abstract class AbstractSelectionC
                 int pos = 0;
                 @Override
                 public boolean isValid(char chr) {
-                    return cap(chr) == CONDSTORE[pos++];
+                    return ImapRequestLineReader.cap(chr) == CONDSTORE[pos++];
                 }
             });
             condstore = true;

Modified: james/imap/trunk/message/src/main/java/org/apache/james/imap/decode/parser/SearchCommandParser.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/message/src/main/java/org/apache/james/imap/decode/parser/SearchCommandParser.java?rev=1145713&r1=1145712&r2=1145713&view=diff
==============================================================================
--- james/imap/trunk/message/src/main/java/org/apache/james/imap/decode/parser/SearchCommandParser.java
(original)
+++ james/imap/trunk/message/src/main/java/org/apache/james/imap/decode/parser/SearchCommandParser.java
Tue Jul 12 18:38:53 2011
@@ -145,12 +145,7 @@ public class SearchCommandParser extends
 
     private int consumeAndCap(ImapRequestLineReader request) throws DecodingException {
         final char next = request.consume();
-        return cap(next);
-    }
-
-    private int cap(char next) {
-        final int cap = next > 'Z' ? next ^ 32 : next;
-        return cap;
+        return ImapRequestLineReader.cap(next);
     }
     
     private SearchKey cc(ImapRequestLineReader request, final Charset charset) throws DecodingException
{
@@ -957,7 +952,7 @@ public class SearchCommandParser extends
         try {
             SearchKey recent = null;
             List<SearchResultOption> options = null;
-            int c = cap(request.nextWordChar());
+            int c = ImapRequestLineReader.cap(request.nextWordChar());
             if (c == 'R') {
                 // if we found a R its either RECENT or RETURN so consume it
                 request.consume();

Modified: james/imap/trunk/message/src/main/java/org/apache/james/imap/decode/parser/StoreCommandParser.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/message/src/main/java/org/apache/james/imap/decode/parser/StoreCommandParser.java?rev=1145713&r1=1145712&r2=1145713&view=diff
==============================================================================
--- james/imap/trunk/message/src/main/java/org/apache/james/imap/decode/parser/StoreCommandParser.java
(original)
+++ james/imap/trunk/message/src/main/java/org/apache/james/imap/decode/parser/StoreCommandParser.java
Tue Jul 12 18:38:53 2011
@@ -42,12 +42,6 @@ public class StoreCommandParser extends 
         super(ImapCommand.selectedStateCommand(ImapConstants.STORE_COMMAND_NAME));
     }
 
-    private int cap(char next) {
-        final int cap = next > 'Z' ? next ^ 32 : next;
-        return cap;
-    }
-    
-
     /*
      * (non-Javadoc)
      * 
@@ -70,7 +64,7 @@ public class StoreCommandParser extends 
             request.consumeWord(new CharacterValidator() {
                 private int pos = 0;
                 public boolean isValid(char chr) {
-                    return cap(chr) == UNCHANGEDSINCE[pos++];
+                    return ImapRequestLineReader.cap(chr) == UNCHANGEDSINCE[pos++];
                 }
             });
             request.consumeChar(' ');



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message