Smack: Null returned for XMPPException.getXMPPError() and XMPPException.getStreamError() with wrong login username/password

I’ve searched everywhere, but I could not find an answer: when I try to log in on any XMPP server (my Openfire setup, talk.google.com, jabber.org) with invalid login username/password, the thrown XMPPException (message: SASL authentication PLAIN failed: not-authorized) does not contain any XMPPError or StreamError (both are null).

The most curious thing is that the Spark Java XMPP client, that uses the same Smack version - v3.2.2 - as I do (I even swapped mine with the Spark one) can handle the invalid login credentials using getXMPPError, which returns the actual XMPP error object, not null! How is that even possible?

I went through the Spark source and I could not figure out anything. I tried countless variations - various ConnectionConfiguration settings, connecting to other Jabber/XMPP servers, nothing helped. I even sniffed the server responses with Wireshark, they are the same for Spark and my application.

I ended up parsing the damn return string “SASL authentication PLAIN failed: not-authorized”…

Can anybody shed some light here?