1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-12-22 18:48:00 +01:00

Make IQ.setType(Type) throw IllegalArgumentException

when argument is 'null'.
This commit is contained in:
Florian Schmaus 2015-01-21 13:20:34 +01:00
parent 0f028fdf50
commit 2f739662e5

View file

@ -76,16 +76,18 @@ public abstract class IQ extends Packet {
/**
* Sets the type of the IQ packet.
* <p>
* Since the type of an IQ must present, an IllegalArgmentException will be thrown when type is
* <code>null</code>.
* </p>
*
* @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() {