作者 靖少毅

调增数组格式声明,random随机转换修正

@@ -894,7 +894,7 @@ public class Convert @@ -894,7 +894,7 @@ public class Convert
894 */ 894 */
895 public static String toSBC(String input, Set<Character> notConvertSet) 895 public static String toSBC(String input, Set<Character> notConvertSet)
896 { 896 {
897 - char c[] = input.toCharArray(); 897 + char[] c = input.toCharArray();
898 for (int i = 0; i < c.length; i++) 898 for (int i = 0; i < c.length; i++)
899 { 899 {
900 if (null != notConvertSet && notConvertSet.contains(c[i])) 900 if (null != notConvertSet && notConvertSet.contains(c[i]))
@@ -936,7 +936,7 @@ public class Convert @@ -936,7 +936,7 @@ public class Convert
936 */ 936 */
937 public static String toDBC(String text, Set<Character> notConvertSet) 937 public static String toDBC(String text, Set<Character> notConvertSet)
938 { 938 {
939 - char c[] = text.toCharArray(); 939 + char[] c = text.toCharArray();
940 for (int i = 0; i < c.length; i++) 940 for (int i = 0; i < c.length; i++)
941 { 941 {
942 if (null != notConvertSet && notConvertSet.contains(c[i])) 942 if (null != notConvertSet && notConvertSet.contains(c[i]))
@@ -5,7 +5,7 @@ import com.google.code.kaptcha.text.impl.DefaultTextCreator; @@ -5,7 +5,7 @@ import com.google.code.kaptcha.text.impl.DefaultTextCreator;
5 5
6 /** 6 /**
7 * 验证码文本生成器 7 * 验证码文本生成器
8 - * 8 + *
9 * @author ruoyi 9 * @author ruoyi
10 */ 10 */
11 public class KaptchaTextCreator extends DefaultTextCreator 11 public class KaptchaTextCreator extends DefaultTextCreator
@@ -20,7 +20,7 @@ public class KaptchaTextCreator extends DefaultTextCreator @@ -20,7 +20,7 @@ public class KaptchaTextCreator extends DefaultTextCreator
20 int x = random.nextInt(10); 20 int x = random.nextInt(10);
21 int y = random.nextInt(10); 21 int y = random.nextInt(10);
22 StringBuilder suChinese = new StringBuilder(); 22 StringBuilder suChinese = new StringBuilder();
23 - int randomoperands = (int) Math.round(Math.random() * 2); 23 + int randomoperands = random.nextInt(3);
24 if (randomoperands == 0) 24 if (randomoperands == 0)
25 { 25 {
26 result = x * y; 26 result = x * y;
@@ -30,7 +30,7 @@ public class KaptchaTextCreator extends DefaultTextCreator @@ -30,7 +30,7 @@ public class KaptchaTextCreator extends DefaultTextCreator
30 } 30 }
31 else if (randomoperands == 1) 31 else if (randomoperands == 1)
32 { 32 {
33 - if (!(x == 0) && y % x == 0) 33 + if ((x != 0) && y % x == 0)
34 { 34 {
35 result = y / x; 35 result = y / x;
36 suChinese.append(CNUMBERS[y]); 36 suChinese.append(CNUMBERS[y]);