Smak 4.4.6: ConnectionListener#connected() returned XMPPConnection value may contain NULL

Below is an extraction of the Google Play Console, Crashes and ANRs Stack trace reported for aTalk v3.1.4 release based on smack 4.4.6.

Stack trace

Sample attributes:
HUAWEI HWELE (HUAWEI P30)
a. Android 10 (SDK 29)
b. Version: 301040 (3.1.4) Occurred: 11 days ago

Type: java.lang.IllegalArgumentException

Exception java.lang.IllegalArgumentException: XMPPConnection must not be null
  at org.jivesoftware.smack.util.Objects.requireNonNull (Objects.java:42)
  at org.jivesoftware.smack.Manager.<init> (Manager.java:33)
  at org.jivesoftware.smackx.iqversion.VersionManager.<init> (VersionManager.java:84)
  at org.jivesoftware.smackx.iqversion.VersionManager.getInstanceFor (VersionManager.java:106)
  at net.java.sip.communicator.impl.protocol.jabber.ProtocolProviderServiceJabberImpl.initServicesAndFeatures (ProtocolProviderServiceJabberImpl.java:1823)
  at net.java.sip.communicator.impl.protocol.jabber.ProtocolProviderServiceJabberImpl.access$1100 (ProtocolProviderServiceJabberImpl.java:271)
  at net.java.sip.communicator.impl.protocol.jabber.ProtocolProviderServiceJabberImpl$XMPPConnectionListener.connected (ProtocolProviderServiceJabberImpl.java:1464)
  at org.jivesoftware.smack.AbstractXMPPConnection.callConnectionConnectedListener (AbstractXMPPConnection.java:1696)
  at org.jivesoftware.smack.AbstractXMPPConnection.connect (AbstractXMPPConnection.java:542)
  at org.jivesoftware.smack.ReconnectionManager$2.run (ReconnectionManager.java:282)
  at java.lang.Thread.run (Thread.java:929)
  at java.lang.Thread.run (Thread.java:784)	

aTalk implements smack ConnectionListener interface, and below is only called in ConnectionListener callback connected(XMPPConnection connection).

initServicesAndFeatures();

Any reason why “XMPPConnection connection” is null even when the service is connected?

private class XMPPConnectionListener implements ConnectionListener {
  .....
        /**
         * Notification that the connection has been successfully connected to the remote endpoint (e.g. the XMPP server).
         *
         * Note that the connection is likely not yet authenticated and therefore only limited operations
         * like registering an account may be possible.
         *
         * @param connection the XMPPConnection which successfully connected to its endpoint.
         */
        public void connected(XMPPConnection connection) {
            /*
             * re-init mConnection in case this is a new re-connection; FFR:
             * java.lang.IllegalArgumentException:
             * at org.jivesoftware.smack.util.Objects.requireNonNull (Objects.java:42)
             *  at org.jivesoftware.smack.Manager.<init> (Manager.java:33)
             *  at org.jivesoftware.smackx.iqversion.VersionManager.<init> (VersionManager.java:84)
             *  at org.jivesoftware.smackx.iqversion.VersionManager.getInstanceFor (VersionManager.java:106)
             *  at net.java.sip.communicator.impl.protocol.jabber.ProtocolProviderServiceJabberImpl.initServicesAndFeatures (ProtocolProviderServiceJabberImpl.java:1734)
             */
            mConnection = (AbstractXMPPConnection) connection;

            xmppConnected.reportSuccess();
            if (connection instanceof XMPPTCPConnection)
                setTrafficClass();

            // check and set auto tune ping interval if necessary
            tunePingInterval();

            // must initialize caps entities upon success connection to ensure it is ready for the very first <iq/> send
            initServicesAndFeatures();

            /*  Start up External Service Discovery Manager XEP-0215 */
            ExternalServiceDiscoveryManager.getInstanceFor(connection);

            /*
             * Broadcast to all others after connection is connected but before actual account registration start.
             * This is required by others to init their states and get ready when the user is authenticated
             */
            // fireRegistrationStateChanged(RegistrationState.UNREGISTERED, RegistrationState.REGISTERING,
            //        RegistrationStateChangeEvent.REASON_USER_REQUEST, "TCP Connection Successful");
        }
....
}

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.