Use try-with-resources
Convert try finally block to try-with-resources
Change-Id: Ie1c7a18c07e60600405e5beba0ff4ae573568fe3
Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java
index b591084..ecd6022 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java
@@ -310,14 +310,8 @@
added = true;
updateMonitor(lmonitor, 1);
}
- BufferedOutputStream stream = null;
- try {
- stream = new BufferedOutputStream(file.openOutputStream(EFS.NONE, null));
+ try (BufferedOutputStream stream = new BufferedOutputStream(file.openOutputStream(EFS.NONE, null))) {
stream.write(xml.getBytes(StandardCharsets.UTF_8));
- } finally {
- if(stream != null) {
- stream.close();
- }
}
//notify file saved
updateMonitor(lmonitor, 1);