8172767: a bulk of tests failed with FileSystemException on Windows
authorsherman
Fri, 13 Jan 2017 01:07:50 -0800
changeset 43099 47f8baf1fcbd
parent 43098 124d24e7988c
child 43100 a7e3457672c7
8172767: a bulk of tests failed with FileSystemException on Windows Reviewed-by: chegar
jdk/src/jdk.jartool/share/classes/sun/tools/jar/Main.java
jdk/src/jdk.jartool/share/classes/sun/tools/jar/Validator.java
--- a/jdk/src/jdk.jartool/share/classes/sun/tools/jar/Main.java	Thu Jan 12 22:44:13 2017 -0800
+++ b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/Main.java	Fri Jan 13 01:07:50 2017 -0800
@@ -434,8 +434,8 @@
 
     private void validateAndClose(File tmpfile) throws IOException {
         if (ok && isMultiRelease) {
-            try {
-                ok = Validator.validate(this, tmpfile);
+            try (JarFile jf = new JarFile(tmpfile)) {
+                ok = Validator.validate(this, jf);
                 if (!ok) {
                     error(formatMsg("error.validator.jarfile.invalid", fname));
                 }
--- a/jdk/src/jdk.jartool/share/classes/sun/tools/jar/Validator.java	Thu Jan 12 22:44:13 2017 -0800
+++ b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/Validator.java	Fri Jan 13 01:07:50 2017 -0800
@@ -74,8 +74,8 @@
         loadModuleDescriptor();
     }
 
-    static boolean validate(Main main, File f) throws IOException {
-        return new Validator(main, new JarFile(f)).validate();
+    static boolean validate(Main main, JarFile jf) throws IOException {
+        return new Validator(main, jf).validate();
     }
 
     private boolean validate() {