You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by ju...@apache.org on 2018/11/02 23:59:42 UTC

[jspwiki] 13/17: log exception instead of using printStackTrace, use UTF-8 constant

This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit 3d0444833a4473fb55d86f88f4dafad5645596f9
Author: juanpablo <ju...@apache.org>
AuthorDate: Sat Nov 3 00:52:48 2018 +0100

    log exception instead of using printStackTrace, use UTF-8 constant
---
 .../main/java/org/apache/wiki/auth/user/AbstractUserDatabase.java   | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/jspwiki-main/src/main/java/org/apache/wiki/auth/user/AbstractUserDatabase.java b/jspwiki-main/src/main/java/org/apache/wiki/auth/user/AbstractUserDatabase.java
index aada83b..fbdf620 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/auth/user/AbstractUserDatabase.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/auth/user/AbstractUserDatabase.java
@@ -19,6 +19,7 @@
 package org.apache.wiki.auth.user;
 
 import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 import java.security.Principal;
@@ -232,7 +233,7 @@ public abstract class AbstractUserDatabase implements UserDatabase
             if ( newPasswordFormat )
             {
                 hashedPassword = getHash( password );
-                return CryptoUtil.verifySaltedPassword( password.getBytes("UTF-8"), storedPassword );
+                return CryptoUtil.verifySaltedPassword( password.getBytes( StandardCharsets.UTF_8 ), storedPassword );
             }
 
             // If old format, verify using the old SHA verification algorithm
@@ -265,8 +266,7 @@ public abstract class AbstractUserDatabase implements UserDatabase
         }
         catch( WikiSecurityException e )
         {
-            log.error( "Could not upgrade SHA password to SSHA because profile could not be saved. Reason: " + e.getMessage() );
-            e.printStackTrace();
+            log.error( "Could not upgrade SHA password to SSHA because profile could not be saved. Reason: " + e.getMessage(), e );
         }
         return false;
     }