Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Spungin2014-09-22 12:19:27 +0000
committerSteven Spungin2014-09-22 12:22:53 +0000
commitac7d05cae6a4035ac60f3964f6cb3e203148a918 (patch)
tree1af33de38985a51545ee17868cc9737d0c6aef7a /bundles
parent5ac75d78fc4831539656905acbfe15d16d300015 (diff)
downloadorg.eclipse.e4.tools-ac7d05cae6a4035ac60f3964f6cb3e203148a918.tar.gz
org.eclipse.e4.tools-ac7d05cae6a4035ac60f3964f6cb3e203148a918.tar.xz
org.eclipse.e4.tools-ac7d05cae6a4035ac60f3964f6cb3e203148a918.zip
Bug 444692 - Remove Warnings
Change-Id: I632122d7d70559146d9eb2d06314117464f10afa Signed-off-by: Steven Spungin <steven@spungin.tv>
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionDataFile.java10
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FilteredContributionDialog.java21
2 files changed, 22 insertions, 9 deletions
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionDataFile.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionDataFile.java
index a0a62377..2750f613 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionDataFile.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionDataFile.java
@@ -568,9 +568,10 @@ public class ContributionDataFile implements IFile {
@Override
public InputStream getContents() throws CoreException {
URL url;
+ ZipFile zip = null;
try {
if (path.getFileExtension().equals("jar")) { //$NON-NLS-1$
- ZipFile zip = new ZipFile(path.toOSString());
+ zip = new ZipFile(path.toOSString());
ZipEntry entry;
if (getContributionData().className != null) {
entry = zip.getEntry(getContributionData().className.replace('.', '/') + ".class"); //$NON-NLS-1$
@@ -595,6 +596,13 @@ public class ContributionDataFile implements IFile {
// perhaps not a bundle
// e.printStackTrace();
throw new CoreException(Status.CANCEL_STATUS);
+ } finally {
+ if (zip != null) {
+ try {
+ zip.close();
+ } catch (IOException e) {
+ }
+ }
}
}
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FilteredContributionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FilteredContributionDialog.java
index e3ad7d08..1ee9389b 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FilteredContributionDialog.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FilteredContributionDialog.java
@@ -245,11 +245,11 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting
searchScopes = valueOf(ResourceSearchScope.class, searchScopesString);
}
- public static <E extends Enum<E>> EnumSet<E> valueOf(Class<E> eClass, String str) {
+ public static <TheType extends Enum<TheType>> EnumSet<TheType> valueOf(Class<TheType> eClass, String str) {
String[] arr = str.substring(1, str.length() - 1).split(","); //$NON-NLS-1$
- EnumSet<E> set = EnumSet.noneOf(eClass);
+ EnumSet<TheType> set = EnumSet.noneOf(eClass);
for (String e : arr)
- set.add(E.valueOf(eClass, e.trim()));
+ set.add(TheType.valueOf(eClass, e.trim()));
return set;
}
@@ -1020,11 +1020,16 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting
public BundleModel loadBundleModel(IProject currentProject) throws CoreException {
Document document = new Document();
- String content = new Scanner(PDEProject.getManifest(currentProject).getContents()).useDelimiter("\\Z").next(); //$NON-NLS-1$
- document.set(content);
- BundleModel model = new BundleModel(document, false);
- model.load();
- return model;
+ Scanner scanner = new Scanner(PDEProject.getManifest(currentProject).getContents());
+ try {
+ String content = scanner.useDelimiter("\\Z").next(); //$NON-NLS-1$
+ document.set(content);
+ BundleModel model = new BundleModel(document, false);
+ model.load();
+ return model;
+ } finally {
+ scanner.close();
+ }
}
protected EnumSet<ResourceSearchScope> getSearchScopes() {

Back to the top