You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by de...@apache.org on 2007/03/21 04:22:21 UTC
svn commit: r520732 -
/myfaces/shared/branches/3_0_0/core/src/main/java/org/apache/myfaces/shared/util/StateUtils.java
Author: dennisbyrne
Date: Tue Mar 20 20:22:20 2007
New Revision: 520732
URL: http://svn.apache.org/viewvc?view=rev&rev=520732
Log:
better logging
Modified:
myfaces/shared/branches/3_0_0/core/src/main/java/org/apache/myfaces/shared/util/StateUtils.java
Modified: myfaces/shared/branches/3_0_0/core/src/main/java/org/apache/myfaces/shared/util/StateUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/branches/3_0_0/core/src/main/java/org/apache/myfaces/shared/util/StateUtils.java?view=diff&rev=520732&r1=520731&r2=520732
==============================================================================
--- myfaces/shared/branches/3_0_0/core/src/main/java/org/apache/myfaces/shared/util/StateUtils.java (original)
+++ myfaces/shared/branches/3_0_0/core/src/main/java/org/apache/myfaces/shared/util/StateUtils.java Tue Mar 20 20:22:20 2007
@@ -194,9 +194,7 @@
public static byte[] encrypt(byte[] insecure, ExternalContext ctx)
{
-
return symmetric(insecure, ctx, Cipher.ENCRYPT_MODE);
-
}
public static final byte[] compress(byte[] bytes)
@@ -287,9 +285,7 @@
public static byte[] decrypt(byte[] secure, ExternalContext ctx)
{
-
return symmetric(secure, ctx, Cipher.DECRYPT_MODE);
-
}
/**
@@ -425,30 +421,48 @@
}
private static String findAlgorithmParams(ExternalContext ctx) {
- String _algorithmParams = ctx.getInitParameter(INIT_ALGORITHM_PARAM);
- if (_algorithmParams == null)
+
+ String algorithmParams = ctx.getInitParameter(INIT_ALGORITHM_PARAM);
+
+ if (algorithmParams == null)
{
- if (log.isDebugEnabled())
- {
- log.debug("Using default algorithm paramaters "
- + DEFAULT_ALGORITHM_PARAMS);
- }
- _algorithmParams = DEFAULT_ALGORITHM_PARAMS;
+ algorithmParams = DEFAULT_ALGORITHM_PARAMS;
+ }
+
+ if (log.isDebugEnabled())
+ {
+ log.debug("Using algorithm paramaters " + algorithmParams);
}
- return _algorithmParams;
+
+ return algorithmParams;
}
private static String findAlgorithm(ExternalContext ctx) {
- String _algorithm = ctx.getInitParameter(INIT_ALGORITHM);
- if (_algorithm == null)
+
+ return findAlgorithm( ctx.getInitParameter(INIT_ALGORITHM) );
+
+ }
+
+ private static String findAlgorithm(ServletContext ctx) {
+
+ return findAlgorithm( ctx.getInitParameter(INIT_ALGORITHM) );
+
+ }
+
+ private static String findAlgorithm(String initParam) {
+
+ if (initParam == null)
{
- if (log.isDebugEnabled())
- {
- log.debug("Using default algorithm " + DEFAULT_ALGORITHM);
- }
- _algorithm = DEFAULT_ALGORITHM;
+ initParam = DEFAULT_ALGORITHM;
}
- return _algorithm;
+
+ if (log.isDebugEnabled())
+ {
+ log.debug("Using algorithm " + initParam);
+ }
+
+ return initParam;
+
}
/**
@@ -480,8 +494,12 @@
if(_secret == null)
{
- bytes = new byte[8];
+ int length = 8;
+ bytes = new byte[length];
new Random().nextBytes(bytes);
+
+ if(log.isDebugEnabled())
+ log.debug("generated random password of length " + length);
}
else
{
@@ -491,17 +509,4 @@
return bytes;
}
- private static String findAlgorithm(ServletContext ctx) {
- String _algorithm = ctx.getInitParameter(INIT_ALGORITHM);
-
- if (_algorithm == null)
- {
- if (log.isDebugEnabled())
- {
- log.debug("Using default algorithm " + DEFAULT_ALGORITHM);
- }
- _algorithm = DEFAULT_ALGORITHM;
- }
- return _algorithm;
- }
}