diff --git a/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java b/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java index 92a25b64e..0c2c59a14 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java @@ -1406,6 +1406,13 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { return successNonza; } + private void maybeNotifyDebuggerAboutIncoming(TopLevelStreamElement incomingTopLevelStreamElement) { + final SmackDebugger debugger = this.debugger; + if (debugger != null) { + debugger.onIncomingStreamElement(incomingTopLevelStreamElement); + } + } + protected final void parseAndProcessNonza(XmlPullParser parser) throws IOException, XmlPullParserException, SmackParsingException { ParserUtils.assertAtStartTag(parser); @@ -1434,6 +1441,8 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { Nonza nonza = nonzaProvider.parse(parser, incomingStreamXmlEnvironment); + maybeNotifyDebuggerAboutIncoming(nonza); + for (NonzaCallback nonzaCallback : nonzaCallbacks) { nonzaCallback.onNonzaReceived(nonza); } @@ -1473,10 +1482,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { protected void processStanza(final Stanza stanza) throws InterruptedException { assert stanza != null; - final SmackDebugger debugger = this.debugger; - if (debugger != null) { - debugger.onIncomingStreamElement(stanza); - } + maybeNotifyDebuggerAboutIncoming(stanza); lastStanzaReceived = System.currentTimeMillis(); // Deliver the incoming packet to listeners.