Add assert to IQ.initializeAsResultFor(IQ)

This method is not meant to be used to be invoked with the identity.
This commit is contained in:
Florian Schmaus 2019-07-04 15:48:07 +02:00
parent 870e6c674a
commit 1b5a264d52
1 changed files with 2 additions and 0 deletions

View File

@ -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());