Unverified 提交 28b45c48 authored 作者: Andrei Tokar's avatar Andrei Tokar 提交者: GitHub

Merge pull request #780 from crafty78/master

Close JavaFileManager after use.
......@@ -326,9 +326,9 @@ public class SourceCompiler {
Class<?> javaxToolsJavac(String packageName, String className, String source) {
String fullClassName = packageName + "." + className;
StringWriter writer = new StringWriter();
JavaFileManager fileManager = new
try (JavaFileManager fileManager = new
ClassFileManager(JAVA_COMPILER
.getStandardFileManager(null, null, null));
.getStandardFileManager(null, null, null))) {
ArrayList<JavaFileObject> compilationUnits = new ArrayList<>();
compilationUnits.add(new StringJavaFileObject(fullClassName, source));
// cannot concurrently compile
......@@ -338,9 +338,8 @@ public class SourceCompiler {
}
String output = writer.toString();
handleSyntaxError(output);
try {
return fileManager.getClassLoader(null).loadClass(fullClassName);
} catch (ClassNotFoundException e) {
} catch (ClassNotFoundException | IOException e) {
throw DbException.convert(e);
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论