powered by Jive Software

Smack - fix for NPE in SASLMechanism.java

I was getting NPE from Base64.encodeBytes(), as response was null.

So in SASLMechanism.java at line 154, I replaced

String authenticationText = Base64.encodeBytes(response,Base64.DONT_BREAK_LINES);
        if(authenticationText.equals("")) {
            authenticationText = "=";


String authenticationText = "";
        if( null != response ){
          authenticationText = Base64.encodeBytes(response, Base64.DONT_BREAK_LINES);
        if(authenticationText.equals("")) {
            authenticationText = "=";

and now authentization works.

Ondra Zizka

Great to see you provide patches. Would be more convenient if you would attach a diff file for your patch. Then it could be easily applied to a project or attached in JIRA (bug tracking system).

Attaching diff.

BTW, to reproduce the bug, try connecting to the jabber.cz server with 3.1.0.
SASL-NPE-patch.diff (865 Bytes)

filed - SMACK-264

Fixed for trunk version on revision 11256.