1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-22 22:32:06 +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.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,11 +42,9 @@ 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;
} }