diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/settings/GenericSettings.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/settings/GenericSettings.java
index a8f117f53..5c4222034 100644
--- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/settings/GenericSettings.java
+++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/settings/GenericSettings.java
@@ -17,9 +17,9 @@
package org.jivesoftware.smackx.workgroup.settings;
-import org.jivesoftware.smackx.workgroup.util.ModelUtil;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.provider.IQProvider;
+import org.jivesoftware.smack.util.StringUtils;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@@ -67,7 +67,7 @@ public class GenericSettings extends IQ {
@Override
protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder buf) {
buf.append('>');
- if (ModelUtil.hasLength(getQuery())) {
+ if (StringUtils.isNotEmpty(getQuery())) {
buf.append("null
The result of
- * this method is determined as follows:
- *
o1
and o2
are the same object
- * according to the ==
operator, return
- * true
.
- * o1
or o2
is
- * null
, return false
.
- * o1.equals(o2)
.
- * - *
- * For array types, one of theequals
methods in
- * {@link java.util.Arrays} should be used instead of this method.
- * Note that arrays with more than one dimension will require some
- * custom code in order to implement equals
properly.
- */
- public static final boolean areEqual(Object o1, Object o2) {
- if (o1 == o2) {
- return true;
- }
- else if (o1 == null || o2 == null) {
- return false;
- }
- else {
- return o1.equals(o2);
- }
- }
-
- /**
- * This is a utility method that compares two Booleans when one or
- * both of the objects might be null
The result of
- * this method is determined as follows:
- * b1
and b2
are both TRUE or
- * neither b1
nor b2
is TRUE,
- * return true
.
- * false
.
- * null
. The result
- * returned by this method is determined as follows:
- * o1
and o2
are the same object
- * according to the ==
operator, return
- * false
.
- * o1
or o2
is
- * null
, return true
.
- * !o1.equals(o2)
.
- * - *
- * For array types, one of theequals
methods in
- * {@link java.util.Arrays} should be used instead of this method.
- * Note that arrays with more than one dimension will require some
- * custom code in order to implement equals
properly.
- */
- public static final boolean areDifferent(Object o1, Object o2) {
- return !areEqual(o1, o2);
- }
-
-
- /**
- * This is a utility method that compares two Booleans when one or
- * both of the objects might be null
The result of
- * this method is determined as follows:
- * b1
and b2
are both TRUE or
- * neither b1
nor b2
is TRUE,
- * return false
.
- * true
.
- *
- */
- public static final boolean areBooleansDifferent(Boolean b1, Boolean b2) {
- return !areBooleansEqual(b1, b2);
- }
-
-
- /**
- * Returns true
if the specified array is not null
- * and contains a non-null element. Returns false
- * if the array is null or if all the array elements are null.
- */
- public static final boolean hasNonNullElement(Object[] array) {
- if (array != null) {
- final int n = array.length;
- for (int i = 0; i < n; i++) {
- if (array[i] != null) {
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- * Returns a single string that is the concatenation of all the
- * strings in the specified string array. A single space is
- * put between each string array element. Null array elements
- * are skipped. If the array itself is null, the empty string
- * is returned. This method is guaranteed to return a non-null
- * value, if no expections are thrown.
- */
- public static final String concat(String[] strs) {
- return concat(strs, " "); //NOTRANS
- }
-
- /**
- * Returns a single string that is the concatenation of all the
- * strings in the specified string array. The strings are separated
- * by the specified delimiter. Null array elements are skipped. If
- * the array itself is null, the empty string is returned. This
- * method is guaranteed to return a non-null value, if no expections
- * are thrown.
- */
- public static final String concat(String[] strs, String delim) {
- if (strs != null) {
- final StringBuilder buf = new StringBuilder();
- final int n = strs.length;
- for (int i = 0; i < n; i++) {
- final String str = strs[i];
- if (str != null) {
- buf.append(str).append(delim);
- }
- }
- final int length = buf.length();
- if (length > 0) {
- // Trim trailing space.
- buf.setLength(length - 1);
- }
- return buf.toString();
- }
- else {
- return ""; // NOTRANS
- }
- }
-
- /**
- * Returns true
if the specified {@link String} is not
- * null
and has a length greater than zero. This is
- * a very frequently occurring check.
- */
- public static final boolean hasLength(String s) {
- return (s != null && s.length() > 0);
- }
-
-
- /**
- * Returns null
if the specified string is empty or
- * null
. Otherwise the string itself is returned.
- */
- public static final String nullifyIfEmpty(String s) {
- return ModelUtil.hasLength(s) ? s : null;
- }
-
- /**
- * Returns null
if the specified object is null
- * or if its toString()
representation is empty.
- * Otherwise, the toString()
representation of the
- * object itself is returned.
- */
- public static final String nullifyingToString(Object o) {
- return o != null ? nullifyIfEmpty(o.toString()) : null;
- }
-
- /**
- * Determines if a string has been changed.
- *
- * @param oldString is the initial value of the String
- * @param newString is the new value of the String
- * @return true If both oldString and newString are null or if they are
- * both not null and equal to each other. Otherwise returns false.
- */
- public static boolean hasStringChanged(String oldString, String newString) {
- if (oldString == null && newString == null) {
- return false;
- }
- else if ((oldString == null && newString != null)
- || (oldString != null && newString == null)) {
- return true;
- }
- else {
- return !oldString.equals(newString);
- }
- }
-
- public static String getTimeFromLong(long diff) {
- final String HOURS = "h";
- final String MINUTES = "min";
- final String SECONDS = "sec";
-
- final long MS_IN_A_DAY = 1000 * 60 * 60 * 24;
- final long MS_IN_AN_HOUR = 1000 * 60 * 60;
- final long MS_IN_A_MINUTE = 1000 * 60;
- final long MS_IN_A_SECOND = 1000;
- diff = diff % MS_IN_A_DAY;
- long numHours = diff / MS_IN_AN_HOUR;
- diff = diff % MS_IN_AN_HOUR;
- long numMinutes = diff / MS_IN_A_MINUTE;
- diff = diff % MS_IN_A_MINUTE;
- long numSeconds = diff / MS_IN_A_SECOND;
- diff = diff % MS_IN_A_SECOND;
-
- StringBuilder buf = new StringBuilder();
- if (numHours > 0) {
- buf.append(numHours + " " + HOURS + ", ");
- }
-
- if (numMinutes > 0) {
- buf.append(numMinutes + " " + MINUTES + ", ");
- }
-
- buf.append(numSeconds + " " + SECONDS);
-
- String result = buf.toString();
- return result;
- }
-
-
- /**
- * Build a List of all elements in an Iterator.
- */
- public static