mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 12:02:05 +01:00
Make END_TAG parsing more NPE robust
by calling String.equals() on the constant string and not on the return value of parser.getName(). Also perform the access to 'parser' on a different LOC than equals(). This should help debugging things like okt 25, 2017 2:02:54 PM org.jivesoftware.smack.AbstractXMPPConnection callConnectionClosedOnErrorListener WARNING: Connection XMPPTCPConnection[***@***/***] (0) closed with error java.lang.NullPointerException at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1194) at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$300(XMPPTCPConnection.java:982) at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:998) at java.lang.Thread.run(Thread.java:745) which where recently reported on the forums.
This commit is contained in:
parent
0729392ab8
commit
1b2521269e
1 changed files with 2 additions and 1 deletions
|
@ -1191,7 +1191,8 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case XmlPullParser.END_TAG:
|
case XmlPullParser.END_TAG:
|
||||||
if (parser.getName().equals("stream")) {
|
final String endTagName = parser.getName();
|
||||||
|
if ("stream".equals(endTagName)) {
|
||||||
if (!parser.getNamespace().equals("http://etherx.jabber.org/streams")) {
|
if (!parser.getNamespace().equals("http://etherx.jabber.org/streams")) {
|
||||||
LOGGER.warning(XMPPTCPConnection.this + " </stream> but different namespace " + parser.getNamespace());
|
LOGGER.warning(XMPPTCPConnection.this + " </stream> but different namespace " + parser.getNamespace());
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue