geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wickersheimer Jeremy (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (GERONIMO-6485) NullPointerException at IMAPTaggedResponse.isBAD(IMAPTaggedResponse.java:86) with IMAP server like Dovecot or Gmail
Date Wed, 07 Aug 2013 04:13:50 GMT

    [ https://issues.apache.org/jira/browse/GERONIMO-6485?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13731616#comment-13731616
] 

Wickersheimer Jeremy edited comment on GERONIMO-6485 at 8/7/13 4:13 AM:
------------------------------------------------------------------------

{code}
/geronimo/javamail/store/imap/connection/IMAPResponseTokenizer.java
index 4856f76..939f6ba 100644
--- a/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/imap/connection/IMAPResponseTokenizer.java
+++ b/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/imap/connection/IMAPResponseTokenizer.java
@@ -277,7 +277,7 @@ public class IMAPResponseTokenizer {
                 eatWhiteSpace();
                 return readToken(nilAllowed, expandedDelimiters);
             // either a CTL or special.  These characters have a self-defining token type.
-            } else if (ch < 32 || ch >= 127 || delimiters.indexOf(ch) != -1) {
+            } else if (ch < 32 || ch >= 127 || delimiters.indexOf(ch) != -1 || ch ==
Token.CONTINUATION) {
                 pos++;
                 return new Token((int)ch, String.valueOf((char)ch));
             } else {
diff --git a/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/imap/connection/IMAPTaggedResponse.java
b/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/imap/connection/IMAPTaggedResponse.java
index b1de093..0e1622c 100644
--- a/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/imap/connection/IMAPTaggedResponse.java
+++ b/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/imap/connection/IMAPTaggedResponse.java
@@ -113,7 +113,12 @@ public class IMAPTaggedResponse extends IMAPResponse {              
                                                                                         
                                                         
     {                                                                                   
                                                                                         
                                                         
         // we're passed back a challenge value, Base64 encoded.  Decode that portion of the
                                                                                         
                                                      
         // response data.                                                               
                                                                                         
                                                         
-        return Base64.decode(response, 2, response.length - 2);                         
                                                                                         
                                                         
+        if (response.length > 2) {                                                   
                                                                                         
                                                            
+            return Base64.decode(response, 2, response.length - 2);                     
                                                                                         
                                                         
+        } else {                                                                        
                                                                                         
                                                         
+            return null;                                                                
                                                                                         
                                                         
+        }                                                                               
                                                                                         
                                                         
+                                                                                        
                                                                                         
                                                         
     } 
{code}
                
      was (Author: jwickers):
    /geronimo/javamail/store/imap/connection/IMAPResponseTokenizer.java
index 4856f76..939f6ba 100644
--- a/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/imap/connection/IMAPResponseTokenizer.java
+++ b/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/imap/connection/IMAPResponseTokenizer.java
@@ -277,7 +277,7 @@ public class IMAPResponseTokenizer {
                 eatWhiteSpace();
                 return readToken(nilAllowed, expandedDelimiters);
             // either a CTL or special.  These characters have a self-defining token type.
-            } else if (ch < 32 || ch >= 127 || delimiters.indexOf(ch) != -1) {
+            } else if (ch < 32 || ch >= 127 || delimiters.indexOf(ch) != -1 || ch ==
Token.CONTINUATION) {
                 pos++;
                 return new Token((int)ch, String.valueOf((char)ch));
             } else {
diff --git a/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/imap/connection/IMAPTaggedResponse.java
b/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/imap/connection/IMAPTaggedResponse.java
index b1de093..0e1622c 100644
--- a/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/imap/connection/IMAPTaggedResponse.java
+++ b/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/imap/connection/IMAPTaggedResponse.java
@@ -113,7 +113,12 @@ public class IMAPTaggedResponse extends IMAPResponse {              
                                                                                         
                                                         
     {                                                                                   
                                                                                         
                                                         
         // we're passed back a challenge value, Base64 encoded.  Decode that portion of the
                                                                                         
                                                      
         // response data.                                                               
                                                                                         
                                                         
-        return Base64.decode(response, 2, response.length - 2);                         
                                                                                         
                                                         
+        if (response.length > 2) {                                                   
                                                                                         
                                                            
+            return Base64.decode(response, 2, response.length - 2);                     
                                                                                         
                                                         
+        } else {                                                                        
                                                                                         
                                                         
+            return null;                                                                
                                                                                         
                                                         
+        }                                                                               
                                                                                         
                                                         
+                                                                                        
                                                                                         
                                                         
     } 
                  
> NullPointerException at IMAPTaggedResponse.isBAD(IMAPTaggedResponse.java:86) with IMAP
server like Dovecot or Gmail
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: GERONIMO-6485
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-6485
>             Project: Geronimo
>          Issue Type: Bug
>      Security Level: public(Regular issues) 
>          Components: mail
>    Affects Versions: 3.0.0
>            Reporter: Wickersheimer Jeremy
>             Fix For: 3.0.0
>
>         Attachments: geronimo_javamail.patch
>
>
> Using IMAP with some servers replying with a continuation character "+" will throw
> java.lang.NullPointerException at org.apache.geronimo.javamail.store.imap.connection.IMAPTaggedResponse.isBAD(IMAPTaggedResponse.java:86)
> The problem is in geronimo-javamail/geronimo-javamail_1.4 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message