powered by Jive Software

Smack 4.4.0-alpha2-20190206: superClass Provider.java parametric check throws ClassCastException on aTalk ExtensionElementProvider subClass


#1

aTalk has just integrated and upgraded to the latest Smack 4.4.0-alpha2-SNAPSHOT released on 20190206, but encounter problem in its ExtensionElementProvider subclass implementation.
The superClass Provider constructor throws ClassCastException when executing the statement

elementClass =  (Class<E>) elementType;

I am not sure if this is due to aTalk sub-class implementation depth. Below is the debug log and attached patch to resolve the problem i.e. additional statement

+        if (!(elementType instanceof Class))
+            elementType = elementType.getClass();

Provider.patch (863 Bytes)

2019-02-07 14:04:06.668 28413-29073/org.atalk.android E/aTalk: [1215] service.protocol.AccountManager.runInLoadStoredAccountsThread().414 Failed to load accounts for net.java.sip.communicator.impl.protocol.jabber.ProtocolProviderFactoryJabberImpl@21167fe
java.lang.ClassCastException: libcore.reflect.TypeVariableImpl cannot be cast to java.lang.Class
at org.jivesoftware.smack.provider.Provider.(Provider.java:57)
at org.jivesoftware.smack.provider.ExtensionElementProvider.(ExtensionElementProvider.java:29)
at net.java.sip.communicator.impl.protocol.jabber.extensions.DefaultPacketExtensionProvider.(DefaultPacketExtensionProvider.java:50)
at net.java.sip.communicator.impl.protocol.jabber.extensions.coin.CoinIQProvider.(CoinIQProvider.java:45)
at net.java.sip.communicator.impl.protocol.jabber.ProtocolProviderServiceJabberImpl.initialize(ProtocolProviderServiceJabberImpl.java:1909)
at net.java.sip.communicator.impl.protocol.jabber.ProtocolProviderFactoryJabberImpl.createService(ProtocolProviderFactoryJabberImpl.java:132)
at net.java.sip.communicator.service.protocol.ProtocolProviderFactory.loadAccount(ProtocolProviderFactory.java:919)
at net.java.sip.communicator.service.protocol.AccountManager.doLoadStoredAccounts(AccountManager.java:152)
at net.java.sip.communicator.service.protocol.AccountManager.loadStoredAccounts(AccountManager.java:307)
at net.java.sip.communicator.service.protocol.AccountManager.runInLoadStoredAccountsThread(AccountManager.java:407)
at net.java.sip.communicator.service.protocol.AccountManager.access$100(AccountManager.java:35)
at net.java.sip.communicator.service.protocol.AccountManager$2.run(AccountManager.java:342)