mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-25 21:42:07 +01:00
Use switch/case instead if/else-if in parsePackets()
This commit is contained in:
parent
403ecff2b2
commit
e090067358
1 changed files with 7 additions and 5 deletions
|
@ -1010,8 +1010,9 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
||||||
try {
|
try {
|
||||||
initalOpenStreamSend.checkIfSuccessOrWait();
|
initalOpenStreamSend.checkIfSuccessOrWait();
|
||||||
int eventType = parser.getEventType();
|
int eventType = parser.getEventType();
|
||||||
do {
|
while (!done && eventType != XmlPullParser.END_DOCUMENT) {
|
||||||
if (eventType == XmlPullParser.START_TAG) {
|
switch (eventType) {
|
||||||
|
case XmlPullParser.START_TAG:
|
||||||
final String name = parser.getName();
|
final String name = parser.getName();
|
||||||
switch (name) {
|
switch (name) {
|
||||||
case Message.ELEMENT:
|
case Message.ELEMENT:
|
||||||
|
@ -1199,15 +1200,16 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
||||||
LOGGER.warning("Unkown top level stream element: " + name);
|
LOGGER.warning("Unkown top level stream element: " + name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
else if (eventType == XmlPullParser.END_TAG) {
|
case XmlPullParser.END_TAG:
|
||||||
if (parser.getName().equals("stream")) {
|
if (parser.getName().equals("stream")) {
|
||||||
// Disconnect the connection
|
// Disconnect the connection
|
||||||
disconnect();
|
disconnect();
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
eventType = parser.next();
|
eventType = parser.next();
|
||||||
} while (!done && eventType != XmlPullParser.END_DOCUMENT);
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
// The exception can be ignored if the the connection is 'done'
|
// The exception can be ignored if the the connection is 'done'
|
||||||
|
|
Loading…
Reference in a new issue