powered by Jive Software

System.err stack trace printed on disconnect/reconnect

Hello,

I’m working with the latest Smack API with a spotty Internet connection, so there are frequent disconnections from the server. This is occurring quite often, and I pretty much understand what is going on behind the scenes. Unfortunately, this event seems to be printing out to System.err and interfering with my ability to read traces (also directed to System.err while debugging). Is there any way to disable this (XMPPConnection.DEBUG_ENABLED=false didn’t work). Or, should I stop stealing my neighbor’s wi-fi and come back when I have a real issue? Below is a sample of what I am seeing…

java.net.SocketException: Connection closed by remote host

at com.sun.net.ssl.internal.ssl.SSLSocketImpl.checkWrite(Unknown Source)

at com.sun.net.ssl.internal.ssl.AppOutputStream.write(Unknown Source)

at sun.nio.cs.StreamEncoder.writeBytes(Unknown Source)

at sun.nio.cs.StreamEncoder.implFlushBuffer(Unknown Source)

at sun.nio.cs.StreamEncoder.implFlush(Unknown Source)

at sun.nio.cs.StreamEncoder.flush(Unknown Source)

at java.io.OutputStreamWriter.flush(Unknown Source)

at java.io.BufferedWriter.flush(Unknown Source)

at org.jivesoftware.smack.PacketWriter.writePackets(PacketWriter.java:274)

at org.jivesoftware.smack.PacketWriter.access$000(PacketWriter.java:40)

at org.jivesoftware.smack.PacketWriter$1.run(PacketWriter.java:87)

java.io.EOFException: no more data available - expected end tag </stream:stream> to close start tag stream:stream from line 1, parser stopped on END_TAG seen …xmlns=‘http://jabber.org/features/iq-register’/></stream:features>… @1:387

at org.xmlpull.mxp1.MXParser.fillBuf(MXParser.java:3014)

at org.xmlpull.mxp1.MXParser.more(MXParser.java:3025)

at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1144)

at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)

at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:368)

at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44)

at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:76)

java.net.SocketException: Connection closed by remote host

at com.sun.net.ssl.internal.ssl.SSLSocketImpl.checkWrite(Unknown Source)

at com.sun.net.ssl.internal.ssl.AppOutputStream.write(Unknown Source)

at sun.nio.cs.StreamEncoder.writeBytes(Unknown Source)

at sun.nio.cs.StreamEncoder.implFlushBuffer(Unknown Source)

at sun.nio.cs.StreamEncoder.implFlush(Unknown Source)

at sun.nio.cs.StreamEncoder.flush(Unknown Source)

at java.io.OutputStreamWriter.flush(Unknown Source)

at java.io.BufferedWriter.flush(Unknown Source)

at org.jivesoftware.smack.PacketWriter.writePackets(PacketWriter.java:274)

at org.jivesoftware.smack.PacketWriter.access$000(PacketWriter.java:40)

at org.jivesoftware.smack.PacketWriter$1.run(PacketWriter.java:87)

I felt like a total poser sitting on my hands, so I tracked this down. I commented out all instances of “printStackTrace” in PacketReader and PacketWriter classes and rebuilt from source. If any of you Smack champions think this is a bad idea, please let me know if there is another alternative.