Use try-with-resources in FileContentManager
Manually adjusted the JDT cleanup as the try in a try block looked
unnecessary.
Change-Id: If193933cf8396993ab29c6ba87b268b8587e2300
Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/FileContentManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/FileContentManager.java
index 6063fd5..3faff38 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/FileContentManager.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/FileContentManager.java
@@ -96,18 +96,15 @@
if (!f.exists())
return false;
- try {
- DataInputStream input = new DataInputStream(new FileInputStream(f));
- try {
+ try (DataInputStream input = new DataInputStream(new FileInputStream(f))) {
map.putAll(readOldFormatExtensionMappings(input));
- } finally {
- input.close();
- f.delete();
- }
} catch (IOException ex) {
TeamPlugin.log(IStatus.ERROR, ex.getMessage(), ex);
return false;
+ } finally {
+ f.delete();
}
+
return true;
}