1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-22 03:52:06 +01:00

Don't check for END_DOCUMENT parsePackets()

instead use the event switch/case and log a warning if this ever
happens, as it's likely a programming error.
This commit is contained in:
Florian Schmaus 2014-10-21 23:43:11 +02:00
parent e090067358
commit 5f9c342f7e

View file

@ -1010,7 +1010,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
try { try {
initalOpenStreamSend.checkIfSuccessOrWait(); initalOpenStreamSend.checkIfSuccessOrWait();
int eventType = parser.getEventType(); int eventType = parser.getEventType();
while (!done && eventType != XmlPullParser.END_DOCUMENT) { while (!done) {
switch (eventType) { switch (eventType) {
case XmlPullParser.START_TAG: case XmlPullParser.START_TAG:
final String name = parser.getName(); final String name = parser.getName();
@ -1207,6 +1207,11 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
disconnect(); disconnect();
} }
break; break;
case XmlPullParser.END_DOCUMENT:
// This should not happen, log a warning and disconnect()
LOGGER.warning("Got END_DOCUMENT, aborting parsing");
disconnect();
break;
} }
eventType = parser.next(); eventType = parser.next();
} }