1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-26 00:02:06 +01:00

Fix END_DOCUMENT handling in XMPPTCPConnection

The 'break' statement in the END_DOCUMENT case should break the parsing
loop and not the switch/case within. Therefore we need to add a loop
label on break on that label.
This commit is contained in:
Florian Schmaus 2014-11-12 17:36:25 +01:00
parent def8fea05f
commit 301519a264

View file

@ -971,7 +971,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
try { try {
initalOpenStreamSend.checkIfSuccessOrWait(); initalOpenStreamSend.checkIfSuccessOrWait();
int eventType = parser.getEventType(); int eventType = parser.getEventType();
while (!done) { outerloop: while (!done) {
switch (eventType) { switch (eventType) {
case XmlPullParser.START_TAG: case XmlPullParser.START_TAG:
final String name = parser.getName(); final String name = parser.getName();
@ -1162,10 +1162,10 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
} }
break; break;
case XmlPullParser.END_DOCUMENT: case XmlPullParser.END_DOCUMENT:
// This should not happen, log a warning and disconnect() LOGGER.warning("Got END_DOCUMENT, aborting parsing and calling instantShutdown");
LOGGER.warning("Got END_DOCUMENT, aborting parsing"); // Use instantShutdown() because we want to keep the stream state if possible
disconnect(); instantShutdown();
break; break outerloop;
} }
eventType = parser.next(); eventType = parser.next();
} }