Skip to content

Commit cbb4b79

Browse files
widoDaanHoogland
authored andcommitted
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>
1 parent 1acc869 commit cbb4b79

1 file changed

Lines changed: 6 additions & 25 deletions

File tree

utils/src/main/java/com/cloud/utils/StringUtils.java

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
import java.util.regex.Matcher;
3131
import java.util.regex.Pattern;
3232

33-
import org.owasp.esapi.StringUtilities;
34-
3533
public class StringUtils {
3634
private static final char[] hexChar = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
3735

@@ -78,12 +76,13 @@ public static String join(final String delimiter, final Object... components) {
7876
return org.apache.commons.lang.StringUtils.join(components, delimiter);
7977
}
8078

79+
/**
80+
* @deprecated
81+
* Please use org.apache.commons.lang.StringUtils.isNotBlank() as a replacement
82+
*/
83+
@Deprecated
8184
public static boolean isNotBlank(final String str) {
82-
if (str != null && str.trim().length() > 0) {
83-
return true;
84-
}
85-
86-
return false;
85+
return org.apache.commons.lang.StringUtils.isNotBlank(str);
8786
}
8887

8988
public static String cleanupTags(String tags) {
@@ -256,24 +255,6 @@ public static boolean areTagsEqual(final String tags1, final String tags2) {
256255
return lstTags1.containsAll(lstTags2) && lstTags2.containsAll(lstTags1);
257256
}
258257

259-
public static String stripControlCharacters(final String s) {
260-
return StringUtilities.stripControls(s);
261-
}
262-
263-
public static int formatForOutput(final String text, final int start, final int columns, final char separator) {
264-
if (start >= text.length()) {
265-
return -1;
266-
}
267-
268-
int end = start + columns;
269-
if (end > text.length()) {
270-
end = text.length();
271-
}
272-
final String searchable = text.substring(start, end);
273-
final int found = searchable.lastIndexOf(separator);
274-
return found > 0 ? found : end - start;
275-
}
276-
277258
public static Map<String, String> stringToMap(final String s) {
278259
final Map<String, String> map = new HashMap<String, String>();
279260
final String[] elements = s.split(";");

0 commit comments

Comments
 (0)