I’‘ve found that transports are pretty unreliable - but oh well. One problem arises that is more than a trivial concern: Sometimes transports don’‘t send you presence packets for your buddies - for instance an AIM buddy. This means that you just kinda have to guess if he’'s online or not, or request presence notification from him.
That’‘s fine, but if you send him a message and he’'s offline, your transport will send you back a message like this:
<message from="aim.netmindz.net/registered" type="error" to="aolsen@valhalla.dydns.com/laptop" >
<error>faimtest: message to _____ bounced (reason 0x0004: Not logged on)
</error>
</message>
I don’'t know why, but this causes the smack library to disconnect - or at least a packet to be sent to the connection listener.
Can someone point in the right direction to fixing it?
I just uploaded a new Aug 20 daily build. Can you try your test with that build? The important change is that ConnectionListener interface reports errors better (so also make sure you’'ve registered a connection listener to print out errors). If you get a stack trace that seems strange, let me know.
Could you turn on Smack debugging and then paste in the packet that is causing Smack to blow up? It should be authentication response packet. Also, pasting in the full stack trace would help too.
Java version 1.4.2 ok
Exception in thread "main" java.lang.ClassCastException
at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:316)
at com.valhalla.jbother.gui.ConnectorThread.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
at com.valhalla.jbother.gui.AutoLoginDialog.login(Unknown Source)
at com.valhalla.jbother.JBotherLoader.startJBother(Unknown Source)
at JBother.main(Unknown Source)
And here’'s the packet information I got back from the server:
Sorry, here’'s a stack trace with debugging turned on (oops).
Exception in thread "main" java.lang.ClassCastException
at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:316)
at com.valhalla.jbother.gui.ConnectorThread.run(ConnectorThread.java:52) at java.lang.Thread.run(Unknown Source)
at com.valhalla.jbother.gui.AutoLoginDialog.login(AutoLoginDialog.java:7
2)
at com.valhalla.jbother.JBotherLoader.startJBother(JBotherLoader.java:91
)
at JBother.main(JBother.java:69)
Unfortunately, it happens intermittently, but more often than not (even after using the latest version). I don’'t get any errors, just disconnected when I try to send to an offline aim transport contact.
What can I do to get more information? I don’'t get a stack trace or anything.
Have you used the ConnectionListener interface to log whether the connection is closing due to errors? That should be the first thing you check. Also, perhaps it’‘s the server that’'s closing the connection? You should see if you can duplicate the issue on a non-Smack client.
In Jabber (XMPP 0.9) it was never rigidly defined. However, I would say it SHOULD and probably MUST. However, since it wasn’'t specified, I think we need to be able to handle the case where the error subelement is not included.