Bug 558863 - Possible Recource leak warning in
SourceElementQualifierProvider

Change-Id: If6dc90075aa7de5464f97dfec9cd94646ddf16fb
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/SourceElementQualifierProvider.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/SourceElementQualifierProvider.java
index e462fb0..358f215 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/SourceElementQualifierProvider.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/SourceElementQualifierProvider.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
  *
  * This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License 2.0
@@ -15,6 +15,8 @@
 
 
 import java.io.File;
+import java.io.IOException;
+import java.util.zip.ZipFile;
 
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.IPath;
@@ -49,16 +51,23 @@
 			return fJavaLabels.getText(parent);
 		} else if (element instanceof ZipEntryStorage) {
 			ZipEntryStorage storage = (ZipEntryStorage)element;
-			String zipFileName = storage.getArchive().getName();
-			IPath path = new Path(zipFileName);
-			IRuntimeClasspathEntry entry = JavaRuntime.newArchiveRuntimeClasspathEntry(path);
-			IResource res = entry.getResource();
-			if (res == null) {
-				// external
-				return zipFileName;
+			try (ZipFile archive = storage.getArchive()) {
+				String zipFileName = archive.getName();
+				IPath path = new Path(zipFileName);
+				IRuntimeClasspathEntry entry = JavaRuntime.newArchiveRuntimeClasspathEntry(path);
+				IResource res = entry.getResource();
+				if (res == null) {
+					// external
+					return zipFileName;
+				}
+				// internal
+				return res.getName();
+			} catch (IOException e) {
+				e.printStackTrace();
 			}
-			// internal
-			return res.getName();
+			// ZipFile archive = storage.getArchive();
+			// String zipFileName = archive.getName();
+
 		} else if (element instanceof LocalFileStorage) {
 			LocalFileStorage storage = (LocalFileStorage)element;
 			File extFile = storage.getFile();