/** * Unpack matching files from a jar. Entries inside the jar that do * not match the given pattern will be skipped. Keep also a copy * of the entire jar in the same directory for backward compatibility. * TODO remove this feature in a new release and do only unJar * * @param inputStream the jar stream to unpack * @param toDir the destination directory into which to unpack the jar * @param unpackRegex the pattern to match jar entries against * * @throws IOException if an I/O error has occurred or toDir * cannot be created and does not already exist */ @Deprecated public static void unJarAndSave(InputStream inputStream, File toDir, String name, Pattern unpackRegex) throws IOException{ File file = new File(toDir, name); ensureDirectory(toDir); try (OutputStream jar = new FileOutputStream(file); TeeInputStream teeInputStream = new TeeInputStream(inputStream, jar)) { unJar(teeInputStream, toDir, unpackRegex); } }
+ " would create file outside of " + toDir); ensureDirectory(file.getParentFile()); try (OutputStream out = new FileOutputStream(file)) { IOUtils.copyBytes(in, out, BUFFER_SIZE);
+ " would create file outside of " + toDir); ensureDirectory(file.getParentFile()); try (OutputStream out = new FileOutputStream(file)) { IOUtils.copyBytes(jar, out, BUFFER_SIZE);
ensureDirectory(tmpDir); System.exit(-1); ensureDirectory(workDir);
try { File file = new File(toDir, entry.getName()); ensureDirectory(file.getParentFile()); OutputStream out = new FileOutputStream(file); try {
try { File file = new File(toDir, entry.getName()); ensureDirectory(file.getParentFile()); OutputStream out = new FileOutputStream(file); try {
try { File file = new File(toDir, entry.getName()); ensureDirectory(file.getParentFile()); OutputStream out = new FileOutputStream(file); try {
try { File file = new File(toDir, entry.getName()); ensureDirectory(file.getParentFile()); OutputStream out = new FileOutputStream(file); try {
ensureDirectory(tmpDir); System.exit(-1); ensureDirectory(workDir);
ensureDirectory(tmpDir); System.exit(-1); ensureDirectory(workDir);
ensureDirectory(tmpDir); System.exit(-1); ensureDirectory(workDir);
ensureDirectory(tmpDir); System.exit(-1); ensureDirectory(workDir);