From 1b5a264d52a24a7a60b42963e1c6eafb0cf5e9df Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Thu, 4 Jul 2019 15:48:07 +0200 Subject: [PATCH] Add assert to IQ.initializeAsResultFor(IQ) This method is not meant to be used to be invoked with the identity. --- smack-core/src/main/java/org/jivesoftware/smack/packet/IQ.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/IQ.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/IQ.java index 322890fa7..aeb835351 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/IQ.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/IQ.java @@ -261,6 +261,8 @@ public abstract class IQ extends Stanza { } protected final void initializeAsResultFor(IQ request) { + assert this != request; + if (!(request.getType() == Type.get || request.getType() == Type.set)) { throw new IllegalArgumentException( "IQ must be of type 'set' or 'get'. Original IQ: " + request.toXML());