java.io.EOFException: no more data available - expected end tag </stream:stream>

I am using the smack API to connect to Google Talk and send IM messages.

I am getting the following exception.

Here are some details about my environment

  1. I don’t have & or & anywhere in my message (many people on internet got this message because of this symbol)

  2. I get this message once in a while but my connection to GTalk is not idle.

Can you please help me in resolving this error. I am pasting the entire stack trace below

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
… … @4:89181
at org.xmlpull.mxp1.MXParser.fillBuf(MXParser.java:3035)
at org.xmlpull.mxp1.MXParser.more(MXParser.java:3046)
at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1384)
at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:36
8)
at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44)
at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:76)
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
…… @4:89381
at org.xmlpull.mxp1.MXParser.fillBuf(MXParser.java:3035)
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:36
8)
at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44)
at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:76)

The stack trace idicates that the socket over which the XML data is received from the Google network was unexpectedly closed. There’s no clue as to why this happened.

I have seen similar errors happen (can’t remember if it the same or not) when a PacketExtensionProvider reads the stream improperly.

Basically, the provider is supposed to read to the end of a stanza so the next stanza (at a START_TAG position) can be read properly by its appropriate provider. If a provider fails to do this, then the reader is no longer looking at the right point in the stream and has probably read past the beginning of the next stanza, thus missing it altogether. The specifics of what may happen are dependent on the offending provider, it may simply have some fringe case that is handled improperly so that it improperly reads the stanza. It looks like it is advancing to the next END_TAG, which is probably the one for the following stanza instead of its own. Thus the reader is now looking at an END_TAG for which it read no START_TAG and leaves you in an unknown state.