I’‘ve created a PacketListener to handle all presence.SUBSCRIBE messages in an automated fashion. The Packet filter will reject any packets that aren’'t of the appropriate type. Is there any way, after the packet has been rejected to hand control back to the PacketReader? What currently happens is that the client throws an XMPPException after the packet is rejected…
org.jivesoftware.smack.XMPPException: No response from server.
at org.jivesoftware.smack.GroupChat.join(GroupChat.java:122)
at com.cotelligent.jabber.ConfLogger.log(ConfLogger.java:38)
at com.cotelligent.jabber.ConfLogger.main(ConfLogger.java:17)
The issue here is that if I comment out the packet listener part, it connects to the server just fine, ie, no other changes are made. In addition, if it doesn’‘t receive a presence packet, it doesn’'t throw the exception.
(So if I have the client log in, and nothing else’'s on the server it will function normally, or if nothing on the server is subscribed to that user. If I get a subscription update, it will throw the error every time.)
I guess I’‘m not quite clear on what error you’‘re running into. Can you provide a bit more detail? BTW, I edited your message to add tags (without the spaces). It’'s a much better way to paste in code.
well, what seems to happen is that if I receive a Presence Packet and decide not to process it it returns to the proper thread, but the next call (which is to join a conference) throws the XMPP exception
org.jivesoftware.smack.XMPPException: No response from server.
at org.jivesoftware.smack.GroupChat.join(GroupChat.java:122)
at com.cotelligent.jabber.ConfLogger.log(ConfLogger.java:38)
at com.cotelligent.jabber.ConfLogger.main(ConfLogger.java:17)
Nested Exception: Hit uncaught exception java.lang.NullPointerException
and terminates.
I know that I connected just fine, since I received the presence packet, but don’'t understand why it is throwing the exception.
I’'m willing to bundle the code and send it to you, if that would make it any easier to figure out.
Oh, as a side note, there’‘s an error the XMPPException class. Here’'s the trace
Hit uncaught exception java.lang.NullPointerException
java.lang.NullPointerException
at org.jivesoftware.smack.XMPPException.printStackTrace(XMPPException.java:95)
at java.lang.Throwable.printStackTrace(Throwable.java:451)
at org.jivesoftware.smack.XMPPException.printStackTrace(XMPPException.java:87)
at com.cotelligent.jabber.ConfLogger.main(ConfLogger.java:20)
Ok, I seem to have beaten that one, I don’‘t know WHAT I did, but It’‘s not happening now. Instead, I’'m getting this:
Getting Connection...Done.
Logging in...Done.
Setting Packet Listener & Filter...Done.
Broadcasting Presence...Done.
$PresencePacketFilter -> Rejecting Packet...
$PresencePacketFilter -> Rejecting Packet...
$PresencePacketFilter -> Rejecting Packet...
groupchat
com.mysql.jdbc.PreparedStatement@177b3cd: insert into log values(''5b4U810'',''httpclient@conference.sdfbsd'',''groupchat'',null,''logger has become available'', now())
FOUND OTHER PRESENCE TYPE: subscribe
$PresencePacketFilter -> Accepting Presence Packet...
Sending Subscribed Response.
java.lang.NullPointerException
at org.jivesoftware.smack.filter.FromContainsFilter.accept(FromContainsFilter.java:79)
at org.jivesoftware.smack.filter.AndFilter.accept(AndFilter.java:83)
at org.jivesoftware.smack.PacketCollector.processPacket(PacketCollector.java:195)
at org.jivesoftware.smack.PacketReader.processPacket(PacketReader.java:311)
at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:250)
at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:73)
at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:98)$PresencePacketFilter -> Rejecting Packet...
All of these errors seem to happen in/around my Listener/Filter… I’‘m wondering if I implemented it correctly, or if it’'s really the cause of these problems.
Ok, I seem to have beaten that one, I don’'t know WHAT
I did, but It’‘s not happening now. Instead, I’'m
getting this:
I think this is a bug in the FromContainsFilter. Basically, it’‘s not checking to make sure the packet from field isn’‘t null. I’'ve now fixed this bug as well.