powered by Jive Software

XMPPConnection closed during file transfer from Android to Spark

My app crashes after the user on Spark accepts the file for transfer. Can anyone help me find out why this happens?

My logcat :

I/System.out﹕ tcp port:7777 D/dalvikvm﹕ create interp thread : stack size=128KB D/dalvikvm﹕ create new thread D/dalvikvm﹕ new thread created D/dalvikvm﹕ update thread list D/dalvikvm﹕ threadid=31: interp stack at 0x6308b000 D/dalvikvm﹕ threadid=31: created from interp D/dalvikvm﹕ start new thread D/dalvikvm﹕ threadid=31: notify debugger D/dalvikvm﹕ threadid=31 (Thread-4359): calling run() D/SMACK﹕ SENT (0): <iq to='proxy.serverip' id='87PqQ-43' type='get'><query xmlns='http://jabber.org/protocol/bytestreams'/></iq> D/SMACK﹕ RECV (0): <iq type="result" id="87PqQ-43" from="proxy.serverip" to="me@serverip/Smack"><query xmlns="http://jabber.org/protocol/bytestreams"><streamhost jid="proxy.175.139.183.204" port="7777"/></query></iq> W/XMPPTCPConnection﹕ shutdownDone was not marked as successful by the writer thread org.jivesoftware.smack.SmackException$NoResponseException: No response received within reply timeout. Timeout was 5000ms (~5s). Used filter: No filter used or filter was 'null'. at org.jivesoftware.smack.SynchronizationPoint.checkForResponse(SynchronizationPoint.java:253) at org.jivesoftware.smack.SynchronizationPoint.checkIfSuccessOrWait(SynchronizationPoint.java:146) at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketWriter.shutdown(XMPPTCPConnection.java:1278) at org.jivesoftware.smack.tcp.XMPPTCPConnection.shutdown(XMPPTCPConnection.java:503) at org.jivesoftware.smack.tcp.XMPPTCPConnection.instantShutdown(XMPPTCPConnection.java:492) at org.jivesoftware.smack.tcp.XMPPTCPConnection.notifyConnectionError(XMPPTCPConnection.java:872) at org.jivesoftware.smack.tcp.XMPPTCPConnection.access$2800(XMPPTCPConnection.java:140) at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketWriter.writePackets(XMPPTCPConnection.java:1428) at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketWriter.access$2900(XMPPTCPConnection.java:1179) at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketWriter$1.run(XMPPTCPConnection.java:1227) at java.lang.Thread.run(Thread.java:841) I/System.out﹕ [CDS]close[55522] D/dalvikvm﹕ threadid=14: exiting D/dalvikvm﹕ threadid=14: bye! I/System.out﹕ close [socket][/0.0.0.0:55522] W/AbstractXMPPConnection﹕ Connection closed with error java.lang.NullPointerException at org.jivesoftware.smack.util.LazyStringBuilder.length(LazyStringBuilder.java:72) at org.jivesoftware.smack.util.LazyStringBuilder.toString(LazyStringBuilder.java:100) at org.jivesoftware.smack.util.XmlStringBuilder.toString(XmlStringBuilder.java:344) at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketWriter.writePackets(XMPPTCPConnection.java:1377) at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketWriter.access$2900(XMPPTCPConnection.java:1179) at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketWriter$1.run(XMPPTCPConnection.java:1227) at java.lang.Thread.run(Thread.java:841) D/SMACK﹕ XMPPConnection closed due to an exception (0) W/System.err﹕ java.lang.NullPointerException W/System.err﹕ at org.jivesoftware.smack.util.LazyStringBuilder.length(LazyStringBuilder.java:72) W/System.err﹕ at org.jivesoftware.smack.util.LazyStringBuilder.toString(LazyStringBuilder.java:100) W/System.err﹕ at org.jivesoftware.smack.util.XmlStringBuilder.toString(XmlStringBuilder.java:344) W/System.err﹕ at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketWriter.writePackets(XMPPTCPConnection.java:1377) W/System.err﹕ at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketWriter.access$2900(XMPPTCPConnection.java:1179) W/System.err﹕ at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketWriter$1.run(XMPPTCPConnection.java:1227) W/System.err﹕ at java.lang.Thread.run(Thread.java:841) D/dalvikvm﹕ threadid=13: exiting D/dalvikvm﹕ threadid=13: bye! D/dalvikvm﹕ threadid=30: exiting D/dalvikvm﹕ threadid=30: bye!

What I know is that a NullPointerException is returned when trying to write the xml to send to the server side. What I dont know is why it will return null and because it returns null, it causes my XMPPConnection connection to close.

Any feedback is appreciated.

I suspect a custom ExtensionElement or IQ of yours is using XmlStringBuilder incorrectly. I’ve commited Log LazyStringBuilder instances throwing a NPE · Flowdalic/Smack@b51d507 · GitHub which will eventually go into 4.2.1. This should show the instance causing the NPE.