changeset 3604:7efa4b3477b2 jdk-9+133

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 278610c0ed61
children fcaa7bda5629 4b17f176d19c
files src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java	Mon Aug 22 09:12:11 2016 -0700
+++ b/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;