Two bugs found in asmack-android-8-4.0.4.jar

I`m using asmack-android-8-4.0.4.jar in my project, I found 2 bugs.

FIRST:

Log in with user A and successed , then call XMPPTCPConnection.disconnect(); log in with user B ,then the weird thing happens ,its not user B logged in but user A .I have looked up the source code ,I think the problem is at XMPPConnection.wasAuthenticated.When user A logged in and disconnect,the connection made “wasAuthenticated” as true , the next time I call XMPPConnection.connect() ,it will call XMPPConnection.connectInternal() which will has user A logged in .

SECOND:

Log in with the WRONG password just for SASLErrorException.SASLError.not_authorized , then log in with the RIGHT password , it will always throw SASLErrorException.SASLError.not_authorized, the user can never login .I have looked up the source code , I think the problem is at SASLAuthentication.saslFailure. When log in with the WRONG password ,SASLAuthentication.authenticationFailed() will be called and the SASLAuthentication.saslFailure will not be null ,When log in with the RIGHT password ,SASLAuthentication.authenticated() will be called but SASLAuthentication.saslFailure is still not null , then it will throw SASLErrorException, so the user cannot log in unless XMPPConnection.connect() is called before XMPPConnection.login() which will set SASLAuthentication.saslFailure as null .

ps: Please ingore my poor english .

Thanks for reporting! Very appreciated. I’ll have a look at it once I find the time.

SMACK-614 and SMACK-615. A potential fix for SMACK-614 has been included in asmack-android-8-4.0.6-SNAPSHOT-2014-11-08.jar. Please test and report back.

I also tend to mark SMACK-615 as “won’t fix”, changing the username+password using the same connection instance will become impossible anyways once ConnectionConfiguration becomes immutable and carries this information (which it should have done in the first place).

I decided to go with the immutable ConnectionConfiguration. There will be no fix for this in Smack 4.0.