CLOUDSTACK-10225: Deprecate StringUtils in favor of Apache Commons (#2431)

* CLOUDSTACK-10225: Remove unused methods from StringUtils

Signed-off-by: Wido den Hollander <wido@widodh.nl>

* CLOUDSTACK-10225: Deprecate StringUtils.isNotBlank

Signed-off-by: Wido den Hollander <wido@widodh.nl>

* CLOUDSTACK-10225: Make isNotBlank a wrapper around Apache Commons

Signed-off-by: Wido den Hollander <wido@widodh.nl>
This commit is contained in:
Wido den Hollander 2018-01-31 09:48:32 +01:00 committed by dahn
parent 1acc8690c4
commit cbb4b79390

View File

@ -30,8 +30,6 @@ import java.util.Random;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.owasp.esapi.StringUtilities;
public class StringUtils {
private static final char[] hexChar = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
@ -78,12 +76,13 @@ public class StringUtils {
return org.apache.commons.lang.StringUtils.join(components, delimiter);
}
/**
* @deprecated
* Please use org.apache.commons.lang.StringUtils.isNotBlank() as a replacement
*/
@Deprecated
public static boolean isNotBlank(final String str) {
if (str != null && str.trim().length() > 0) {
return true;
}
return false;
return org.apache.commons.lang.StringUtils.isNotBlank(str);
}
public static String cleanupTags(String tags) {
@ -256,24 +255,6 @@ public class StringUtils {
return lstTags1.containsAll(lstTags2) && lstTags2.containsAll(lstTags1);
}
public static String stripControlCharacters(final String s) {
return StringUtilities.stripControls(s);
}
public static int formatForOutput(final String text, final int start, final int columns, final char separator) {
if (start >= text.length()) {
return -1;
}
int end = start + columns;
if (end > text.length()) {
end = text.length();
}
final String searchable = text.substring(start, end);
final int found = searchable.lastIndexOf(separator);
return found > 0 ? found : end - start;
}
public static Map<String, String> stringToMap(final String s) {
final Map<String, String> map = new HashMap<String, String>();
final String[] elements = s.split(";");