mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 20:12:07 +01:00
Make IQ.setType(Type) throw IllegalArgumentException
when argument is 'null'.
This commit is contained in:
parent
0f028fdf50
commit
2f739662e5
1 changed files with 6 additions and 4 deletions
|
@ -76,17 +76,19 @@ public abstract class IQ extends Packet {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the type of the IQ 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.
|
* @param type the type of the IQ packet.
|
||||||
*/
|
*/
|
||||||
public void setType(Type type) {
|
public void setType(Type type) {
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
this.type = Type.get;
|
throw new IllegalArgumentException("type must not be null");
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public final String getChildElementName() {
|
public final String getChildElementName() {
|
||||||
return childElementName;
|
return childElementName;
|
||||||
|
|
Loading…
Reference in a new issue