[Smack-4.1] NullPointerException in roster push

I’m using Smack 4.1.9, I know it’s not maintained any longer, but nevertheless maybe this issue is also present in latest version:

java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.indexOf(int)' on a null object reference
       at org.jxmpp.util.XmppStringUtils.parseBareJid(XmppStringUtils.java:124)
       at org.jivesoftware.smack.roster.Roster$RosterPushListener.handleIQRequest(Roster.java:1416)
       at org.jivesoftware.smack.AbstractXMPPConnection$2.run(AbstractXMPPConnection.java:1061)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
       at java.lang.Thread.run(Thread.java:818)

It’s probably just a simple null pointer based on the fact that the connection is no yet bound maybe (AbstractXMPPConnection.user is null) - in that case the problem is on the server side, which is even more serious.

Any thoughts?

Thanks

Indeed it looks like an IQ received over an unbound connection. Smack 4.2 will handle this more gracefully.

1 Like