From a13e2d8e8cfae8c19277b65a83742dd81b15a3c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E7=90=A6=E6=B6=9B?= Date: Tue, 4 Apr 2023 10:36:05 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90fix=20sonar=E3=80=91RandImageUtil?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/jero/modules/system/util/RandImageUtil.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/util/RandImageUtil.java b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/util/RandImageUtil.java index 8335beae..8bb714f1 100644 --- a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/util/RandImageUtil.java +++ b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/util/RandImageUtil.java @@ -82,7 +82,6 @@ public class RandImageUtil { base64 = base64.replace("\n", "").replace("\r", "");//删除 \r\n //写到指定位置 - //ImageIO.write(bufferedImage, "png", new File("")); return BASE64_PRE+base64; } @@ -99,7 +98,6 @@ public class RandImageUtil { // graphics.setColor(getRandColor(100, 200)); // ---2 graphics.drawRect(0, 0, WIDTH - 1, HEIGHT - 1); -// final Random random = new Random(); // 随机产生干扰线,使图象中的认证码不易被其它程序探测到 for (int i = 0; i < COUNT; i++) { graphics.setColor(getRandColor(150, 200)); // ---3 @@ -114,11 +112,9 @@ public class RandImageUtil { for (int i = 0; i < resultCode.length(); i++) { // 将认证码显示到图象中,调用函数出来的颜色相同,可能是因为种子太接近,所以只能直接生成 // graphics.setColor(new Color(20 + random.nextInt(130), 20 + random - // .nextInt(130), 20 + random.nextInt(130))); // 设置字体颜色 graphics.setColor(Color.BLACK); // 设置字体样式 -// graphics.setFont(new Font("Arial Black", Font.ITALIC, 18)); graphics.setFont(new Font("Times New Roman", Font.BOLD, 24)); // 设置字符,字符间距,上边距 graphics.drawString(String.valueOf(resultCode.charAt(i)), (23 * i) + 8, 26); @@ -133,7 +129,6 @@ public class RandImageUtil { } private static Color getRandColor(int fc, int bc) { // 取得给定范围随机颜色 -// final Random random = new Random(); if (fc > 255) { fc = 255; }