< prev index next >

jdk/test/tools/jar/JarBackSlash.java

Print this page

        

*** 26,36 **** */ /* * @test * @bug 7201156 ! * @modules jdk.jartool/sun.tools.jar * @summary jar tool fails to convert file separation characters for list and extract * @author Sean Chou */ import java.io.File; --- 26,36 ---- */ /* * @test * @bug 7201156 ! * @modules jdk.jartool * @summary jar tool fails to convert file separation characters for list and extract * @author Sean Chou */ import java.io.File;
*** 41,54 **** import java.io.PrintStream; import java.util.ArrayList; import java.util.List; import java.util.jar.JarEntry; import java.util.jar.JarOutputStream; ! ! import sun.tools.jar.Main; public class JarBackSlash { // used construct an entry JarBackSlash/dir/file.txt private static String JARBACKSLASH = "JarBackSlash"; private static String DIR = "dir"; private static String FILENAME = "file.txt"; --- 41,57 ---- import java.io.PrintStream; import java.util.ArrayList; import java.util.List; import java.util.jar.JarEntry; import java.util.jar.JarOutputStream; ! import java.util.spi.ToolProvider; public class JarBackSlash { + private static final ToolProvider JAR_TOOL = ToolProvider.findFirst("jar") + .orElseThrow(() -> + new RuntimeException("jar tool not found") + ); // used construct an entry JarBackSlash/dir/file.txt private static String JARBACKSLASH = "JarBackSlash"; private static String DIR = "dir"; private static String FILENAME = "file.txt";
*** 76,87 **** PipedOutputStream pipedOutput = new PipedOutputStream(); PipedInputStream pipedInput = new PipedInputStream(pipedOutput); PrintStream out = new PrintStream(pipedOutput); ! Main jarTool = new Main(out, System.err, "jar"); ! if (!jarTool.run(jarArgs)) { fail("Could not list jar file."); } out.flush(); check(pipedInput.available() > 0); --- 79,90 ---- PipedOutputStream pipedOutput = new PipedOutputStream(); PipedInputStream pipedInput = new PipedInputStream(pipedOutput); PrintStream out = new PrintStream(pipedOutput); ! int rc = JAR_TOOL.run(out, System.err, jarArgs); ! if (rc != 0) { fail("Could not list jar file."); } out.flush(); check(pipedInput.available() > 0);
*** 99,110 **** PipedOutputStream pipedOutput = new PipedOutputStream(); PipedInputStream pipedInput = new PipedInputStream(pipedOutput); PrintStream out = new PrintStream(pipedOutput); ! Main jarTool = new Main(out, System.err, "jar"); ! if (!jarTool.run(jarArgs)) { fail("Could not list jar file."); } out.flush(); check(pipedInput.available() > 0); --- 102,113 ---- PipedOutputStream pipedOutput = new PipedOutputStream(); PipedInputStream pipedInput = new PipedInputStream(pipedOutput); PrintStream out = new PrintStream(pipedOutput); ! int rc = JAR_TOOL.run(out, System.err, jarArgs); ! if (rc != 0) { fail("Could not list jar file."); } out.flush(); check(pipedInput.available() > 0);
< prev index next >