mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
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:
parent
1acc8690c4
commit
cbb4b79390
@ -30,8 +30,6 @@ import java.util.Random;
|
|||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.owasp.esapi.StringUtilities;
|
|
||||||
|
|
||||||
public class StringUtils {
|
public class StringUtils {
|
||||||
private static final char[] hexChar = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
|
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);
|
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) {
|
public static boolean isNotBlank(final String str) {
|
||||||
if (str != null && str.trim().length() > 0) {
|
return org.apache.commons.lang.StringUtils.isNotBlank(str);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String cleanupTags(String tags) {
|
public static String cleanupTags(String tags) {
|
||||||
@ -256,24 +255,6 @@ public class StringUtils {
|
|||||||
return lstTags1.containsAll(lstTags2) && lstTags2.containsAll(lstTags1);
|
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) {
|
public static Map<String, String> stringToMap(final String s) {
|
||||||
final Map<String, String> map = new HashMap<String, String>();
|
final Map<String, String> map = new HashMap<String, String>();
|
||||||
final String[] elements = s.split(";");
|
final String[] elements = s.split(";");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user