diff options
author | Parshad Patel <pars.patel@samsung.com> | 2019-03-07 11:44:21 +0900 |
---|---|---|
committer | Oren Kleks <orenkle@amdocs.com> | 2019-03-11 12:16:02 +0000 |
commit | 0e7aacdd1620cea42a9588702f99f2dc24d78112 (patch) | |
tree | 6a2819ed298cca8d3c8f66a4876b761758de9570 /security-utils/src/main/java/org/openecomp/sdc/security/Passwords.java | |
parent | 0a1d82ac04a8ef78bfdcbcced4f5096c050edcfe (diff) |
Fix sonar issues in security-utils
Fix Either log or rethrow this exception issue
Fix Move this constructor to comply with Java Code Conventions
Add Log.isWarnEnabled check
Format string using formatter
Issue-ID: SDC-1895
Change-Id: I54a6867a50ffafaf284be0e8e2e8ed3d1dac3f23
Signed-off-by: Parshad Patel <pars.patel@samsung.com>
Diffstat (limited to 'security-utils/src/main/java/org/openecomp/sdc/security/Passwords.java')
-rw-r--r-- | security-utils/src/main/java/org/openecomp/sdc/security/Passwords.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/security-utils/src/main/java/org/openecomp/sdc/security/Passwords.java b/security-utils/src/main/java/org/openecomp/sdc/security/Passwords.java index 5f5e00722e..f22bc481b4 100644 --- a/security-utils/src/main/java/org/openecomp/sdc/security/Passwords.java +++ b/security-utils/src/main/java/org/openecomp/sdc/security/Passwords.java @@ -54,7 +54,7 @@ public class Passwords { public static String hashPassword(String password) { if (password!=null){ byte[] salt = getNextSalt(); - byte byteData[] = hash(salt, password.getBytes()); + byte[] byteData = hash(salt, password.getBytes()); if (byteData != null) { return toHex(salt) + ":" + toHex(byteData); } @@ -105,7 +105,7 @@ public class Passwords { byte[] saltBytes = fromHex(salt); byte[] hashBytes = fromHex(hash); - byte byteData[] = hash(saltBytes, password.getBytes()); + byte[] byteData = hash(saltBytes, password.getBytes()); if (byteData != null) { return Arrays.equals(byteData, hashBytes); } @@ -148,6 +148,7 @@ public class Passwords { md.update(password); byteData = md.digest(); } catch (NoSuchAlgorithmException e) { + log.error("invalid algorithm name {}", e); System.out.println("invalid algorithm name"); } return byteData; |