feat : 模拟执行报错
This commit is contained in:
@@ -100,7 +100,8 @@ public class JavaCodeEngine {
|
||||
// 设置安全检查器
|
||||
System.setSecurityManager(securityManager);
|
||||
// 执行方法并返回结果
|
||||
return ConsoleCapture.capture(() -> method.invoke(null, args));
|
||||
return new EngineResult(method.invoke(null, args), null);
|
||||
// return ConsoleCapture.capture(() -> method.invoke(null, args));
|
||||
} catch (CustomException e) {
|
||||
EngineResult result = new EngineResult();
|
||||
result.setSuccess(Boolean.FALSE);
|
||||
@@ -279,7 +280,7 @@ public class JavaCodeEngine {
|
||||
}
|
||||
|
||||
|
||||
public void remove(){
|
||||
public void remove() {
|
||||
clazz = null;
|
||||
classLoader = null;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import cn.fateverse.common.code.console.ConsoleCapture;
|
||||
import cn.fateverse.common.code.lock.SegmentLock;
|
||||
import cn.fateverse.common.code.model.EngineResult;
|
||||
import cn.fateverse.common.core.exception.CustomException;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import org.graalvm.polyglot.Context;
|
||||
import org.graalvm.polyglot.Value;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user