Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/templates/ContributionTemplateStore.java')
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/templates/ContributionTemplateStore.java28
1 files changed, 7 insertions, 21 deletions
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/templates/ContributionTemplateStore.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/templates/ContributionTemplateStore.java
index d7479dd8667..0a78eadd605 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/templates/ContributionTemplateStore.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/templates/ContributionTemplateStore.java
@@ -132,19 +132,17 @@ public class ContributionTemplateStore extends TemplateStore {
URL url= FileLocator.find(plugin, Path.fromOSString(file), null);
if (url != null) {
ResourceBundle bundle= null;
- InputStream bundleStream= null;
- InputStream stream= null;
- try {
- String translations= element.getAttribute(TRANSLATIONS);
- if (translations != null) {
- URL bundleURL= FileLocator.find(plugin, Path.fromOSString(translations), null);
- if (bundleURL != null) {
- bundleStream= bundleURL.openStream();
+ String translations= element.getAttribute(TRANSLATIONS);
+ if (translations != null) {
+ URL bundleURL= FileLocator.find(plugin, Path.fromOSString(translations), null);
+ if (bundleURL != null) {
+ try (InputStream bundleStream= bundleURL.openStream()) {
bundle= new PropertyResourceBundle(bundleStream);
}
}
+ }
- stream= new BufferedInputStream(url.openStream());
+ try (InputStream stream= new BufferedInputStream(url.openStream())) {
TemplateReaderWriter reader= new TemplateReaderWriter();
TemplatePersistenceData[] datas= reader.read(stream, bundle);
for (int i= 0; i < datas.length; i++) {
@@ -158,18 +156,6 @@ public class ContributionTemplateStore extends TemplateStore {
templates.add(data);
}
}
- } finally {
- try {
- if (bundleStream != null)
- bundleStream.close();
- } catch (IOException x) {
- } finally {
- try {
- if (stream != null)
- stream.close();
- } catch (IOException x) {
- }
- }
}
}
}

Back to the top