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

Use StringUtils in SpoilerElement

This commit is contained in:
Florian Schmaus 2018-02-22 09:03:09 +01:00
parent 81f599425a
commit 4292659f22

View file

@ -24,6 +24,7 @@ import java.util.Map;
import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smack.util.XmlStringBuilder;
public class SpoilerElement implements ExtensionElement {
@ -41,10 +42,8 @@ public class SpoilerElement implements ExtensionElement {
* @param hint hint about the content.
*/
public SpoilerElement(String language, String hint) {
if (language != null && !language.equals("")) {
if (hint == null || hint.equals("")) {
throw new IllegalArgumentException("Hint cannot be null or empty if language is not empty.");
}
if (StringUtils.isNotEmpty(language) && StringUtils.isNullOrEmpty(hint)) {
throw new IllegalArgumentException("Hint cannot be null or empty if language is not empty.");
}
this.language = language;
this.hint = hint;