You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2018/01/31 08:48:36 UTC

[GitHub] DaanHoogland closed pull request #2431: CLOUDSTACK-10225: Deprecate StringUtils in favor of Apache Commons

DaanHoogland closed pull request #2431: CLOUDSTACK-10225: Deprecate StringUtils in favor of Apache Commons
URL: https://github.com/apache/cloudstack/pull/2431
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/utils/src/main/java/com/cloud/utils/StringUtils.java b/utils/src/main/java/com/cloud/utils/StringUtils.java
index 6ada2ad60bd..aed6cef6217 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.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 static String join(final String delimiter, final Object... components) {
         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 static boolean areTagsEqual(final String tags1, final String tags2) {
         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(";");


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services