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 c66683515..070c9eb09 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 @@ -76,16 +76,18 @@ public abstract class IQ extends Packet { /** * Sets the type of the IQ packet. + *

+ * Since the type of an IQ must present, an IllegalArgmentException will be thrown when type is + * null. + *

* * @param type the type of the IQ packet. */ public void setType(Type type) { if (type == null) { - this.type = Type.get; - } - else { - this.type = type; + throw new IllegalArgumentException("type must not be null"); } + this.type = type; } public final String getChildElementName() {