fixed sonar bugs
This commit is contained in:
@ -1,7 +1,3 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package de.muehlencord.shared.security;
|
||||
|
||||
import static com.lambdaworks.crypto.SCryptUtil.check;
|
||||
@ -11,8 +7,6 @@ import java.security.NoSuchAlgorithmException;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.Arrays;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.log4j.Logger;
|
||||
import static org.apache.log4j.Logger.getLogger;
|
||||
/**
|
||||
*
|
||||
* @author joern@muehlencord.de
|
||||
@ -20,9 +14,8 @@ import static org.apache.log4j.Logger.getLogger;
|
||||
public abstract class PasswordUtil {
|
||||
|
||||
/** logging object */
|
||||
private final static Logger logger = getLogger(PasswordUtil.class);
|
||||
|
||||
|
||||
// private final static Logger LOGGER = Logger.getLogger(PasswordUtil.class);
|
||||
|
||||
/** SCrypt CPU cost parameter */
|
||||
private final static int scryptCpuCostParameter = 16384;
|
||||
/** SCrypt memory cost parameter */
|
||||
@ -105,13 +98,11 @@ public abstract class PasswordUtil {
|
||||
*
|
||||
* @throws SecurityException if the random string could not be computed
|
||||
*/
|
||||
public static String getRandomString(String prefix, int length) throws SecurityException {
|
||||
if (prefix == null) {
|
||||
prefix = "";
|
||||
}
|
||||
int idLength = length - prefix.length();
|
||||
public static String getRandomString(final String prefix, int length) throws SecurityException {
|
||||
String usedPrefix = (prefix == null ? "" : prefix);
|
||||
|
||||
int idLength = length - usedPrefix.length();
|
||||
return prefix + createSaltString(idLength);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user