fix:fixed the engine.eval() return double or Integer result in ArithmeticCaptchaAbstract.java

This commit is contained in:
wangmingcan 2020-08-21 10:28:17 +08:00
parent da3501451b
commit 1b851f198a
1 changed files with 1 additions and 1 deletions

View File

@ -39,7 +39,7 @@ public abstract class ArithmeticCaptchaAbstract extends Captcha {
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByName("javascript");
try {
chars = String.valueOf(engine.eval(sb.toString().replaceAll("x", "*")));
chars = String.valueOf(engine.eval(sb.toString().replaceAll("x", "*"))).split("\\.")[0];
} catch (ScriptException e) {
e.printStackTrace();
}