Quantcast
Channel: Ignite Realtime : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 10742

An exception is thrown when suddenly disconnecting

$
0
0

Hi,

 

I'm developing a XMPP client which connects to a XMPP server.

 

I'm using smack 3.2.1 and Maven.

 

When the server suddenly disconnects, an exception is thrown and you can not catch it.

 

What causes this is the line:

 

e.printStackTrace();

 

which prints the exception to the console, in the class "PacketReader" in this method:

 

voidnotifyConnectionError(Exception e) {

       done =true;

       // Closes the connection temporary. A reconnection is possible

       connection.shutdown(new Presence(Presence.Type.unavailable));

       // Print the stack trace to help catch the problem

       e.printStackTrace();

       // Notify connection listeners of the error.

       for (ConnectionListener listener :connection.getConnectionListeners()) {

           try {

                listener.connectionClosedOnError(e);

            }

           catch (Exception e2) {

               // Catch and print any exception so we can recover

               // from a faulty listener

                e2.printStackTrace();

            }

        }

    }

 

 

The exception is:

 

 

java.net.SocketException: Connection reset

        at java.net.SocketInputStream.read(SocketInputStream.java:168)

        at com.sun.net.ssl.internal.ssl.InputRecord.readFully(InputRecord.java:293)

 

 

        at com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:331)

        at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:798)

        at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:755)

        at com.sun.net.ssl.internal.ssl.AppInputStream.read(AppInputStream.java:75)

        at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:264)

 

 

at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306)

        at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158)

        at java.io.InputStreamReader.read(InputStreamReader.java:167)

        at java.io.BufferedReader.fill(BufferedReader.java:136)

        at java.io.BufferedReader.read1(BufferedReader.java:187)

        at java.io.BufferedReader.read(BufferedReader.java:261)

        at org.jivesoftware.smack.util.ObservableReader.read(ObservableReader.java:42)

 

 

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

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

        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:325)

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

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

 

How can I resolve the problem?


Viewing all articles
Browse latest Browse all 10742

Trending Articles