修复部分sonar问题

This commit is contained in:
zer0Black
2023-12-01 15:23:31 +08:00
parent 123f3e81db
commit d936a816fd
5 changed files with 19 additions and 4 deletions
@@ -33,7 +33,6 @@ public class UsernamePasswordToken extends org.apache.shiro.authc.UsernamePasswo
*/
public UsernamePasswordToken(String username) {
super(username, "");
this.captcha = captcha;
this.type = LoginType.NOPASSWD;
}
@@ -92,10 +92,10 @@ public class SimpleCharVerifyCodeGenImpl implements IVerifyCodeGen {
graphics.setColor(Color.WHITE);
graphics.fillRect(0, 0, width, height);
Random random = new Random();
// 加入干扰线条
for (int i = 0; i < 8; i++) {
graphics.setColor(RandomUtils.randomColor(40, 150));
Random random = new Random();
int x = random.nextInt(width);
int y = random.nextInt(height);
int x1 = random.nextInt(width);
@@ -8,6 +8,7 @@ import com.adc.da.sys.service.UserEOServiceImpl;
import com.adc.da.sys.service.iservice.IUserEoService;
import com.adc.da.sys.vo.LabelReturnVo;
import com.adc.da.util.utils.SpringContextHolder;
import com.adc.da.util.utils.StringUtils;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
@@ -78,7 +79,7 @@ public class CommonUtils {
// }
// CacheUtils.putCache(CACHE_ROLE_LIST, roleList);
// }
if(null == getUserId()) {return null;}
if(StringUtils.isEmpty(getUserId())) {return null;}
List<RoleEO> roleList = roleEOService.getSysRoleListByUserId(getUserId());
return roleList;
@@ -1,5 +1,6 @@
package com.adc.da.login.util;
import com.adc.da.util.exception.AdcDaBaseException;
import org.apache.commons.codec.binary.Base64;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
@@ -39,6 +40,11 @@ public class EncryptUtil {
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
if (encrypt == null){
throw new AdcDaBaseException("加密秘钥异常,请检查");
}
// 取MD5Hash码,并组合加密数组
byte[] md5Hasn = null;
try {
@@ -110,6 +116,10 @@ public class EncryptUtil {
e.printStackTrace();
}
if (temp == null){
throw new AdcDaBaseException("解码秘钥异常,请检查");
}
// 进行解密后的md5Hash校验
byte[] md5Hash = null;
try {
@@ -118,6 +128,10 @@ public class EncryptUtil {
e.printStackTrace();
}
if (md5Hash == null){
throw new AdcDaBaseException("MD5校验码异常,请检查");
}
// 进行解密校检
for (int i = 0; i < md5Hash.length; i++) {
if (md5Hash[i] != temp[i]) {
@@ -1,4 +1,5 @@
<html>
<!DOCTYPE>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">