Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Hammer2019-05-25 13:38:32 +0000
committerKarsten Thoms2019-09-25 18:52:27 +0000
commit46ff79e0c747ec2308cff542015e4b82d6882472 (patch)
tree8402cbf7e54a5fa2c1adb7f9bdd3fbd604ddfd25 /bundles/org.eclipse.team.ui
parentc869c9dfb29c62db5a39b440b425eea6bb85caac (diff)
downloadeclipse.platform.team-46ff79e0c747ec2308cff542015e4b82d6882472.tar.gz
eclipse.platform.team-46ff79e0c747ec2308cff542015e4b82d6882472.tar.xz
eclipse.platform.team-46ff79e0c747ec2308cff542015e4b82d6882472.zip
Use try-with-resourcesI20190926-0625
Convert try finally block to try-with-resources Change-Id: Iff35bb041daf77cd29f9c17ee931c8b2de186e4c Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
Diffstat (limited to 'bundles/org.eclipse.team.ui')
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetImporter.java8
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java5
2 files changed, 2 insertions, 11 deletions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetImporter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetImporter.java
index d8bcb7f67..bd87b9d44 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetImporter.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetImporter.java
@@ -235,16 +235,10 @@ public class ProjectSetImporter {
private static XMLMemento stringToXMLMemento(String stringContents)
throws InvocationTargetException {
- StringReader reader = null;
- try {
- reader = new StringReader(stringContents);
+ try (StringReader reader = new StringReader(stringContents)) {
return XMLMemento.createReadRoot(reader);
} catch (WorkbenchException e) {
throw new InvocationTargetException(e);
- } finally {
- if (reader != null) {
- reader.close();
- }
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java
index 7cd1eb76d..2a3cd25a1 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java
@@ -641,11 +641,8 @@ public class SynchronizeManager implements ISynchronizeManager {
ref.save(participantData);
}
try {
- Writer writer = new BufferedWriter(new FileWriter(getStateFile()));
- try {
+ try (Writer writer = new BufferedWriter(new FileWriter(getStateFile()))) {
xmlMemento.save(writer);
- } finally {
- writer.close();
}
} catch (IOException e) {
TeamUIPlugin.log(new Status(IStatus.ERROR, TeamUIPlugin.ID, 1, TeamUIMessages.SynchronizeManager_10, e));

Back to the top