1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-12-14 00:51:19 +01:00

Add StringUtils.requireNotNullOrEmpty and Objects.requireNonNull

and use this in a few places.
This commit is contained in:
Florian Schmaus 2015-01-26 20:36:55 +01:00
parent 603f64166b
commit 86ea027301
18 changed files with 88 additions and 100 deletions

View file

@ -20,6 +20,7 @@ package org.jivesoftware.smackx.iqversion.packet;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.util.StringUtils;
/**
* A Version IQ packet, which is used by XMPP clients to discover version information
@ -85,16 +86,9 @@ public class Version extends IQ {
*/
public Version(String name, String version, String os) {
super(ELEMENT, NAMESPACE);
if (name == null)
{
throw new IllegalArgumentException("name must not be null");
}
if (version == null) {
throw new IllegalArgumentException("version must not be null");
}
this.setType(IQ.Type.result);
this.name = name;
this.version = version;
this.name = StringUtils.requireNotNullOrEmpty(name, "name must not be null");
this.version = StringUtils.requireNotNullOrEmpty(version, "version must not be null");
this.os = os;
}