Use StringUtils in SpoilerElement

This commit is contained in:
Florian Schmaus 2018-02-22 09:03:09 +01:00
parent 81f599425a
commit 4292659f22
1 changed files with 3 additions and 4 deletions

View File

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