Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Pingel2013-10-04 18:36:08 -0400
committerSteffen Pingel2013-10-04 18:36:56 -0400
commitd40421b43276519180b64c03a7992e978a2134e1 (patch)
tree505142f4f32cb90d30a90e99c6d211dcc6e62c27
parent1ab212f16f16565d429000363cca0b89422216a0 (diff)
downloadorg.eclipse.mylyn.tasks-d40421b43276519180b64c03a7992e978a2134e1.tar.gz
org.eclipse.mylyn.tasks-d40421b43276519180b64c03a7992e978a2134e1.tar.xz
org.eclipse.mylyn.tasks-d40421b43276519180b64c03a7992e978a2134e1.zip
408511: ensure that stream is closed when accessing branding images
Change-Id: I160e4ffd099392f5eea60b2fa88ae4a5a48f5199 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=408511
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/RepositoryConnectorUiExtensionReader.java26
1 files changed, 21 insertions, 5 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/RepositoryConnectorUiExtensionReader.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/RepositoryConnectorUiExtensionReader.java
index 21b21a447..b84496799 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/RepositoryConnectorUiExtensionReader.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/RepositoryConnectorUiExtensionReader.java
@@ -11,8 +11,8 @@
package org.eclipse.mylyn.internal.tasks.ui.util;
+import java.io.IOException;
import java.io.InputStream;
-import java.util.Set;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IAdaptable;
@@ -91,17 +91,33 @@ public class RepositoryConnectorUiExtensionReader {
if (branding != null) {
InputStream brandingImageData = branding.getBrandingImageData();
if (brandingImageData != null) {
- TasksUiPlugin.getDefault().addBrandingIcon(connector.getConnectorKind(),
- getImage(brandingImageData));
+ try {
+ TasksUiPlugin.getDefault().addBrandingIcon(connector.getConnectorKind(),
+ getImage(brandingImageData));
+ } finally {
+ closeQuietly(brandingImageData);
+ }
}
InputStream overlayImageData = branding.getOverlayImageData();
if (overlayImageData != null) {
- TasksUiPlugin.getDefault().addOverlayIcon(connector.getConnectorKind(),
- getImageDescriptor(overlayImageData));
+ try {
+ TasksUiPlugin.getDefault().addOverlayIcon(connector.getConnectorKind(),
+ getImageDescriptor(overlayImageData));
+ } finally {
+ closeQuietly(brandingImageData);
+ }
}
}
}
+ private void closeQuietly(InputStream in) {
+ try {
+ in.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+
@SuppressWarnings("unchecked")
public <T> T loadAdapter(final AbstractRepositoryConnector connector, Class<T> klass) {
T adapter = null;

Back to the top