# HG changeset patch # User Thomas Wuerthinger # Date 1327706348 -3600 # Node ID 374cb5e984f604fb512fb1ac1372d8a2b062e86d # Parent c1524c0d538f815006ea0a452d30c8ebfbe4825e Use try with resources. diff -r c1524c0d538f -r 374cb5e984f6 src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/SaveAsAction.java --- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/SaveAsAction.java Sat Jan 28 00:17:24 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/SaveAsAction.java Sat Jan 28 00:19:08 2012 +0100 @@ -81,10 +81,10 @@ } Settings.get().put(Settings.DIRECTORY, dir.getAbsolutePath()); try { - Writer writer = new OutputStreamWriter(new FileOutputStream(file)); - Printer p = new Printer(); - p.export(writer, doc); - writer.close(); + try (Writer writer = new OutputStreamWriter(new FileOutputStream(file))) { + Printer p = new Printer(); + p.export(writer, doc); + } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) {