changeset 41209:1e31fbc26987

8166287: MultiReleaseJarAPI.isMultiReleaseJar(): failure java.nio.file.AccessDeniedException: custom-mr.jar Reviewed-by: mhaupt, alanb
author redestad
date Wed, 28 Sep 2016 14:29:35 +0200
parents 8a97b5704e66
children 73593ed418ff
files jdk/test/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/test/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java	Wed Sep 28 14:27:34 2016 +0200
+++ b/jdk/test/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java	Wed Sep 28 14:29:35 2016 +0200
@@ -40,6 +40,7 @@
 import java.util.Arrays;
 import java.util.Map;
 import java.util.Random;
+import java.util.concurrent.atomic.AtomicInteger;
 import java.util.jar.JarFile;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
@@ -133,11 +134,14 @@
         testCustomMultiReleaseValue(value, Map.of(), expected);
     }
 
+    private static final AtomicInteger JAR_COUNT = new AtomicInteger(0);
+
     private void testCustomMultiReleaseValue(String value,
             Map<String, String> extraAttributes, boolean expected)
             throws Exception {
-        creator.buildCustomMultiReleaseJar("custom-mr.jar", value, extraAttributes);
-        File custom = new File(userdir, "custom-mr.jar");
+        String fileName = "custom-mr" + JAR_COUNT.incrementAndGet() + ".jar";
+        creator.buildCustomMultiReleaseJar(fileName, value, extraAttributes);
+        File custom = new File(userdir, fileName);
         try (JarFile jf = new JarFile(custom, true, ZipFile.OPEN_READ, Runtime.version())) {
             Assert.assertEquals(jf.isMultiRelease(), expected);
         }