8172767: a bulk of tests failed with FileSystemException on Windows
Reviewed-by: chegar
--- 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() {