changeset 40517:611ca58fca75

8156911: JShell: file manager should be closed Summary: Properly closing the file manager when it is being thrown away on error. Reviewed-by: rfield
author jlahoda
date Mon, 22 Aug 2016 18:19:31 +0200
parents 9e0e107c39dd
children eb9dfc05f8c6
files langtools/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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;