From 4292659f22f3afa87bdcb1a7131338f67111608b Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Thu, 22 Feb 2018 09:03:09 +0100 Subject: [PATCH] Use StringUtils in SpoilerElement --- .../smackx/spoiler/element/SpoilerElement.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/spoiler/element/SpoilerElement.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/spoiler/element/SpoilerElement.java index 1392cd65d..3ee6b08ee 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/spoiler/element/SpoilerElement.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/spoiler/element/SpoilerElement.java @@ -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;