myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r1624033 - in /myfaces/tobago/trunk: tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/ tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/ tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobag...
Date Wed, 10 Sep 2014 15:33:04 GMT
Author: lofwyr
Date: Wed Sep 10 15:33:03 2014
New Revision: 1624033

URL: http://svn.apache.org/r1624033
Log:
utils: confidential string (null pointer aware)

Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/StringUtils.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/InputRendererBase.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/InRenderer.java

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/StringUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/StringUtils.java?rev=1624033&r1=1624032&r2=1624033&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/StringUtils.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/StringUtils.java
Wed Sep 10 15:33:03 2014
@@ -394,6 +394,19 @@ public final class StringUtils {
   }
 
   /**
+   * Returns a string of the same length to hide confidential passwords from log files etc.
+   */
+  public static String toConfidentialString(final String string, final boolean confidential)
{
+    if (string == null) {
+      return "<null>";
+    } else if (confidential) {
+      return repeat("*", string.length()) + " (confidential)";
+    } else {
+      return string;
+    }
+  }
+
+  /**
    * Basically taken from commons-lang
    */
   public static String uncapitalize(final String str) {

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/InputRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/InputRendererBase.java?rev=1624033&r1=1624032&r2=1624033&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/InputRendererBase.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/InputRendererBase.java
Wed Sep 10 15:33:03 2014
@@ -56,9 +56,8 @@ public class InputRendererBase extends L
       String newValue = requestParameterMap.get(clientId);
       if (LOG.isDebugEnabled()) {
         final boolean password = ComponentUtils.getBooleanAttribute(component, Attributes.PASSWORD);
-        LOG.debug("clientId = '" + clientId + "'");
-        LOG.debug("requestParameterMap.get(clientId) = '"
-            + (password ? StringUtils.repeat("*", newValue.length()) : newValue) + "'");
+        LOG.debug("clientId='{}'", clientId);
+        LOG.debug("requestParameterMap.get(clientId)='{}'", StringUtils.toConfidentialString(newValue,
password));
       }
       if (input instanceof UITextarea) {
         UITextarea textarea = (UITextarea) input;

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/InRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/InRenderer.java?rev=1624033&r1=1624032&r2=1624033&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/InRenderer.java
(original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/InRenderer.java
Wed Sep 10 15:33:03 2014
@@ -64,7 +64,7 @@ public class InRenderer extends InputRen
     final String currentValue = getCurrentValue(facesContext, input);
     final boolean password = ComponentUtils.getBooleanAttribute(input, Attributes.PASSWORD);
     if (LOG.isDebugEnabled()) {
-      LOG.debug("currentValue = '" + (password ? StringUtils.repeat("*", currentValue.length())
: currentValue) +  "'");
+      LOG.debug("currentValue = '{}'", StringUtils.toConfidentialString(currentValue, password));
     }
     final String type = password ? HtmlInputTypes.PASSWORD : HtmlInputTypes.TEXT;
     final String id = input.getClientId(facesContext);



Mime
View raw message