Geronimo
  1. Geronimo
  2. GERONIMO-6485

NullPointerException at IMAPTaggedResponse.isBAD(IMAPTaggedResponse.java:86) with IMAP server like Dovecot or Gmail

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 3.0.0
    • Fix Version/s: None
    • Component/s: mail
    • Security Level: public (Regular issues)
    • Labels:
      None
    • Patch Info:
      Patch Available

      Description

      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

      1. geronimo_javamail.patch
        2 kB
        Wickersheimer Jeremy

        Issue Links

          Activity

          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Resolved Resolved
          448d 18h 57m 1 Hendrik Saly 29/Oct/14 23:02
          Hendrik Saly made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Fix Version/s 3.0.0 [ 12314206 ]
          Resolution Duplicate [ 3 ]
          Hendrik Saly made changes -
          Link This issue duplicates GERONIMO-6526 [ GERONIMO-6526 ]
          Hide
          Hendrik Saly added a comment -
          Show
          Hendrik Saly added a comment - seems to be the same issue like https://issues.apache.org/jira/browse/GERONIMO-6526
          Hide
          Wickersheimer Jeremy added a comment - - edited
          /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;                                                                                                                                                                                                                    
          +        }                                                                                                                                                                                                                                   
          +                                                                                                                                                                                                                                            
               } 
          
          Show
          Wickersheimer Jeremy added a comment - - edited /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 ; + } + }
          Wickersheimer Jeremy made changes -
          Field Original Value New Value
          Attachment geronimo_javamail.patch [ 12596502 ]
          Hide
          Wickersheimer Jeremy added a comment -

          This patch applies to the latest GIT from git://git.apache.org/geronimo-javamail.git

          Show
          Wickersheimer Jeremy added a comment - This patch applies to the latest GIT from git://git.apache.org/geronimo-javamail.git
          Wickersheimer Jeremy created issue -

            People

            • Assignee:
              Unassigned
              Reporter:
              Wickersheimer Jeremy
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development