8156911: JShell: file manager should be closed
Summary: Properly closing the file manager when it is being thrown away on error.
Reviewed-by: rfield
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java Mon Aug 22 09:12:11 2016 -0700
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java Mon Aug 22 18:19:31 2016 +0200
@@ -1196,6 +1196,11 @@
fm.setLocationFromPaths(StandardLocation.SOURCE_PATH, sources);
} catch (IOException ex) {
proc.debug(ex, "SourceCodeAnalysisImpl.SourceCache.<init>(...)");
+ try {
+ fm.close();
+ } catch (IOException closeEx) {
+ proc.debug(closeEx, "SourceCodeAnalysisImpl.SourceCache.close()");
+ }
fm = null;
}
this.fm = fm;