CLOUDSTACK-3274: guard a null string case in case of string match.

Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8202acdb
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8202acdb
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8202acdb

Branch: refs/heads/master
Commit: 8202acdbc17add8cbb39cabfcd16ac1a616493eb
Parents: 97ff498
Author: Min Chen <[email protected]>
Authored: Fri Aug 16 10:51:25 2013 -0700
Committer: Min Chen <[email protected]>
Committed: Fri Aug 16 11:10:58 2013 -0700

----------------------------------------------------------------------
 utils/src/com/cloud/utils/StringUtils.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8202acdb/utils/src/com/cloud/utils/StringUtils.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/StringUtils.java 
b/utils/src/com/cloud/utils/StringUtils.java
index 21c7220..c02082c 100644
--- a/utils/src/com/cloud/utils/StringUtils.java
+++ b/utils/src/com/cloud/utils/StringUtils.java
@@ -153,8 +153,10 @@ public class StringUtils {
     // Responsible for stripping sensitive content from request and response 
strings
     public static String cleanString(String stringToClean){
         String cleanResult = "";
-        cleanResult = 
REGEX_PASSWORD_QUERYSTRING.matcher(stringToClean).replaceAll("");
-        cleanResult = REGEX_PASSWORD_JSON.matcher(cleanResult).replaceAll("");
+        if (stringToClean != null) {
+            cleanResult = 
REGEX_PASSWORD_QUERYSTRING.matcher(stringToClean).replaceAll("");
+            cleanResult = 
REGEX_PASSWORD_JSON.matcher(cleanResult).replaceAll("");
+        }
         return cleanResult;
     }
 

Reply via email to