1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-10 18:15:58 +01:00

Throw exception if END_DOCUMENT is seen

instead of calling just instantShutdown(). Now we will catch this
exception, call notifyConnectionError which also calls
instantShutdown() but also notifies the connection listeners of the
event.

Smack should never all instantShutdown() without notifying the
connection listeners.
This commit is contained in:
Florian Schmaus 2015-01-14 17:07:35 +01:00
parent 9cc58ec8a0
commit 3187436ba7

View file

@ -942,7 +942,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
try {
initalOpenStreamSend.checkIfSuccessOrWait();
int eventType = parser.getEventType();
outerloop: while (!done) {
while (!done) {
switch (eventType) {
case XmlPullParser.START_TAG:
final String name = parser.getName();
@ -1114,10 +1114,10 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
}
break;
case XmlPullParser.END_DOCUMENT:
LOGGER.warning("Got END_DOCUMENT, aborting parsing and calling instantShutdown");
// Use instantShutdown() because we want to keep the stream state if possible
instantShutdown();
break outerloop;
// END_DOCUMENT only happens in an error case, as otherwise we would see a
// closing stream element before.
throw new SmackException(
"Parser got END_DOCUMENT event. This could happen e.g. if the server closed the connection without sending a closing stream element");
}
eventType = parser.next();
}