8062504: javadoc Start does not close file managers that it opens
Reviewed-by: ksrini
This commit is contained in:
parent
8bd23f1681
commit
4ce27b2f9e
@ -88,6 +88,9 @@ public class Start extends ToolOption.Helper {
|
|||||||
*/
|
*/
|
||||||
private boolean apiMode;
|
private boolean apiMode;
|
||||||
|
|
||||||
|
private JavaFileManager fileManager;
|
||||||
|
private boolean closeFileManagerOnExit;
|
||||||
|
|
||||||
Start(String programName,
|
Start(String programName,
|
||||||
PrintWriter errWriter,
|
PrintWriter errWriter,
|
||||||
PrintWriter warnWriter,
|
PrintWriter warnWriter,
|
||||||
@ -239,6 +242,12 @@ public class Start extends ToolOption.Helper {
|
|||||||
messager.error(Messager.NOPOS, "main.fatal.exception");
|
messager.error(Messager.NOPOS, "main.fatal.exception");
|
||||||
failed = true;
|
failed = true;
|
||||||
} finally {
|
} finally {
|
||||||
|
if (fileManager != null && closeFileManagerOnExit) {
|
||||||
|
try {
|
||||||
|
fileManager.close();
|
||||||
|
} catch (IOException ignore) {
|
||||||
|
}
|
||||||
|
}
|
||||||
messager.exitNotice();
|
messager.exitNotice();
|
||||||
messager.flush();
|
messager.flush();
|
||||||
}
|
}
|
||||||
@ -270,7 +279,8 @@ public class Start extends ToolOption.Helper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
JavaFileManager fileManager = context.get(JavaFileManager.class);
|
fileManager = context.get(JavaFileManager.class);
|
||||||
|
|
||||||
setDocletInvoker(docletClass, fileManager, argv);
|
setDocletInvoker(docletClass, fileManager, argv);
|
||||||
|
|
||||||
compOpts = Options.instance(context);
|
compOpts = Options.instance(context);
|
||||||
@ -333,6 +343,7 @@ public class Start extends ToolOption.Helper {
|
|||||||
if (fileManager == null) {
|
if (fileManager == null) {
|
||||||
JavacFileManager.preRegister(context);
|
JavacFileManager.preRegister(context);
|
||||||
fileManager = context.get(JavaFileManager.class);
|
fileManager = context.get(JavaFileManager.class);
|
||||||
|
closeFileManagerOnExit = true;
|
||||||
}
|
}
|
||||||
if (fileManager instanceof BaseFileManager) {
|
if (fileManager instanceof BaseFileManager) {
|
||||||
((BaseFileManager) fileManager).handleOptions(fileManagerOpts);
|
((BaseFileManager) fileManager).handleOptions(fileManagerOpts);
|
||||||
|
Loading…
Reference in New Issue
Block a user