< prev index next >

test/tools/jar/ChangeDir.java

Print this page

        

*** 22,43 **** */ /** * @test * @bug 4806786 8023113 ! * @modules jdk.jartool/sun.tools.jar * @summary jar -C doesn't ignore multiple // in path */ import java.io.*; import java.nio.file.*; import java.util.*; import java.util.jar.*; import java.util.stream.Stream; - import sun.tools.jar.Main; public class ChangeDir { private final static String jarName = "test.jar"; private final static String fileName = "hello.txt"; /** Remove dirs & files needed for test. */ private static void cleanup(Path dir) { --- 22,46 ---- */ /** * @test * @bug 4806786 8023113 ! * @modules jdk.jartool * @summary jar -C doesn't ignore multiple // in path */ import java.io.*; import java.nio.file.*; import java.util.*; import java.util.jar.*; + import java.util.spi.ToolProvider; import java.util.stream.Stream; public class ChangeDir { + private static final ToolProvider JAR_TOOL = + ToolProvider.findFirst("jar").get(); + private final static String jarName = "test.jar"; private final static String fileName = "hello.txt"; /** Remove dirs & files needed for test. */ private static void cleanup(Path dir) {
*** 86,97 **** argList.add(jarName); argList.add("-C"); argList.add(topDir.toString() + sep + "a" + sep + sep + "b"); // Note double 'sep' is intentional argList.add(fileName); ! Main jarTool = new Main(System.out, System.err, "jar"); ! if (!jarTool.run(argList.toArray(new String[argList.size()]))) { fail("Could not create jar file."); } // Check that the entry for hello.txt does *not* have a pathname. try (JarFile jf = new JarFile(jarName)) { --- 89,101 ---- argList.add(jarName); argList.add("-C"); argList.add(topDir.toString() + sep + "a" + sep + sep + "b"); // Note double 'sep' is intentional argList.add(fileName); ! int rc = JAR_TOOL.run(System.out, System.err, ! argList.toArray(new String[argList.size()])); ! if (rc != 0) { fail("Could not create jar file."); } // Check that the entry for hello.txt does *not* have a pathname. try (JarFile jf = new JarFile(jarName)) {
< prev index next >