mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-22 06:12:05 +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:
parent
9cc58ec8a0
commit
3187436ba7
1 changed files with 5 additions and 5 deletions
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue