1
0
mirror of https://github.com/whvcse/EasyCaptcha.git synced 2024-11-23 01:59:19 +08:00

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

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();
}