changeset 6645:70b91714c76e

8012156: tools/javac/file/zip/T6865530.java fails for win32/64 Reviewed-by: alanb
author chegar
date Fri, 14 Jun 2013 16:38:13 +0100
parents d6179d8024a8
children fd073e7b57f9
files src/share/classes/sun/misc/URLClassPath.java
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/misc/URLClassPath.java	Wed Jun 26 19:15:34 2013 +0200
+++ b/src/share/classes/sun/misc/URLClassPath.java	Fri Jun 14 16:38:13 2013 +0100
@@ -705,8 +705,16 @@
         /* Throws if the given jar file is does not start with the correct LOC */
         static JarFile checkJar(JarFile jar) throws IOException {
             if (System.getSecurityManager() != null && !DISABLE_JAR_CHECKING
-                && !zipAccess.startsWithLocHeader(jar))
-                throw new IOException("Invalid Jar file");
+                && !zipAccess.startsWithLocHeader(jar)) {
+                IOException x = new IOException("Invalid Jar file");
+                try {
+                    jar.close();
+                } catch (IOException ex) {
+                    x.addSuppressed(ex);
+                }
+                throw x;
+            }
+
             return jar;
         }