You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2018/01/31 08:48:38 UTC
[cloudstack] branch master updated: CLOUDSTACK-10225: Deprecate
StringUtils in favor of Apache Commons (#2431)
This is an automated email from the ASF dual-hosted git repository.
dahn pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/master by this push:
new cbb4b79 CLOUDSTACK-10225: Deprecate StringUtils in favor of Apache Commons (#2431)
cbb4b79 is described below
commit cbb4b7939005113c092504c431cef10211c209ff
Author: Wido den Hollander <wi...@widodh.nl>
AuthorDate: Wed Jan 31 09:48:32 2018 +0100
CLOUDSTACK-10225: Deprecate StringUtils in favor of Apache Commons (#2431)
* CLOUDSTACK-10225: Remove unused methods from StringUtils
Signed-off-by: Wido den Hollander <wi...@widodh.nl>
* CLOUDSTACK-10225: Deprecate StringUtils.isNotBlank
Signed-off-by: Wido den Hollander <wi...@widodh.nl>
* CLOUDSTACK-10225: Make isNotBlank a wrapper around Apache Commons
Signed-off-by: Wido den Hollander <wi...@widodh.nl>
---
.../src/main/java/com/cloud/utils/StringUtils.java | 31 +++++-----------------
1 file changed, 6 insertions(+), 25 deletions(-)
diff --git a/utils/src/main/java/com/cloud/utils/StringUtils.java b/utils/src/main/java/com/cloud/utils/StringUtils.java
index 6ada2ad..aed6cef 100644
--- a/utils/src/main/java/com/cloud/utils/StringUtils.java
+++ b/utils/src/main/java/com/cloud/utils/StringUtils.java
@@ -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(";");
--
To stop receiving notification emails like this one, please contact
dahn@apache.org.