File tree Expand file tree Collapse file tree 1 file changed +3
-10
lines changed
visualvm/libs.profiler/profiler/src/org/graalvm/visualvm/lib/profiler Expand file tree Collapse file tree 1 file changed +3
-10
lines changed Original file line number Diff line number Diff line change @@ -1339,25 +1339,18 @@ private Lookup.Provider findProjectForSnapshot(FileObject selectedFile) {
13391339
13401340 private LoadedSnapshot loadSnapshotFromFileObject (FileObject selectedFile )
13411341 throws IOException {
1342- DataInputStream dis = null ;
1343-
1344- try {
1342+ try (
13451343 InputStream is = selectedFile .getInputStream ();
13461344 BufferedInputStream bis = new BufferedInputStream (is );
1347- dis = new DataInputStream (bis );
1348-
1345+ DataInputStream dis = new DataInputStream (bis );
1346+ ) {
13491347 LoadedSnapshot ls = LoadedSnapshot .loadSnapshot (dis );
13501348
13511349 if (ls != null ) {
13521350 ls .setFile (FileUtil .toFile (selectedFile ));
13531351 ls .setProject (findProjectForSnapshot (selectedFile ));
13541352 }
1355-
13561353 return ls ;
1357- } finally {
1358- if (dis != null ) {
1359- dis .close ();
1360- }
13611354 }
13621355 }
13631356
You can’t perform that action at this time.
0 commit comments