I have the problem with handling packets in the next code:
connection.sendPacket(packet);
PacketFilter filter = new AndFilter(
new PacketIDFilter(packet.getPacketID()),
new PacketTypeFilter(IQ.class)
);
PacketCollector collector = connection.createPacketCollector(filter);
IQ result = (IQ)collector.nextResult(waitTime);
collector.cancel();
// in this point I have (result == null)
// and connection is closed !!!!!
If an exception occurs while parsing the received XML then the connection will be closed. When this happens all the ConnectionListeners of the connection are notified of the exception.
You can try to add a ConnectionListener to the connection in order to find out which is the exception. Please let us know if itβ's a parsing problem so that we can solve the issue.
public void connectionClosedOnError (Exception exc)
{
exc.printStackTrace();
}
result:
org.xmlpull.v1.XmlPullParserException: parser must be on START_TAG or TEXT to read text (position: START_TAG seen ...ture-not-implemented xmlns=\''urn:ietf:params:xml:ns:xmpp-stanzas\''/>... @1:1876)
at org.xmlpull.mxp1.MXParser.nextText(MXParser.java:1115)
at org.jivesoftware.smack.PacketReader.parseError(PacketReader.java:611)
at org.jivesoftware.smack.PacketReader.parseIQ(PacketReader.java:378)
at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:277)
at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:77)
at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:103)