Test 2
parent
2f55267ce2
commit
011283dc09
|
@ -50,19 +50,31 @@ public class GenericTarDecompressor {
|
||||||
File file = target.toPath().resolve(entry.getName()).toFile();
|
File file = target.toPath().resolve(entry.getName()).toFile();
|
||||||
|
|
||||||
if(entry.isDirectory()) {
|
if(entry.isDirectory()) {
|
||||||
file.mkdirs();
|
try {
|
||||||
|
Files.createDirectories(file.toPath());
|
||||||
|
} catch (IOException e) {
|
||||||
|
Statics.LOGGER.error("An exception occurred when trying to create {}", file, e);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
File parent = file.getParentFile();
|
File parent = file.getParentFile();
|
||||||
|
|
||||||
|
try {
|
||||||
|
Files.createDirectories(parent.toPath());
|
||||||
|
} catch (IOException e) {
|
||||||
|
Statics.LOGGER.error("An exception occurred when trying to create {}", file, e);
|
||||||
|
}
|
||||||
|
/*
|
||||||
if (!parent.isDirectory() && !parent.mkdirs()) {
|
if (!parent.isDirectory() && !parent.mkdirs()) {
|
||||||
Statics.LOGGER.error("Failed to create {}", parent);
|
Statics.LOGGER.error("Failed to create {}", parent);
|
||||||
} else {
|
Statics.LOGGER.error("Skipping: {}", file);
|
||||||
try (OutputStream outputStream = Files.newOutputStream(file.toPath());
|
continue;
|
||||||
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(outputStream)) {
|
}*/
|
||||||
IOUtils.copy(archiveInputStream, bufferedOutputStream);
|
|
||||||
} catch (IOException e) {
|
try (OutputStream outputStream = Files.newOutputStream(file.toPath());
|
||||||
Statics.LOGGER.error("An exception occurred while trying to decompress file: {}", file.getName(), e);
|
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(outputStream)) {
|
||||||
}
|
IOUtils.copy(archiveInputStream, bufferedOutputStream);
|
||||||
|
} catch (IOException e) {
|
||||||
|
Statics.LOGGER.error("An exception occurred while trying to decompress file: {}", file.getName(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,19 +47,27 @@ public class ZipDecompressor {
|
||||||
File file = target.toPath().resolve(entry.getName()).toFile();
|
File file = target.toPath().resolve(entry.getName()).toFile();
|
||||||
|
|
||||||
if(entry.isDirectory()) {
|
if(entry.isDirectory()) {
|
||||||
file.mkdirs();
|
try {
|
||||||
|
Files.createDirectories(file.toPath());
|
||||||
|
} catch (IOException e) {
|
||||||
|
Statics.LOGGER.error("An exception occurred when trying to create {}", file, e);
|
||||||
|
}
|
||||||
|
//if(!file.isDirectory() && !file.mkdirs())
|
||||||
|
// Statics.LOGGER.error("Failed to create: {}", file);
|
||||||
} else {
|
} else {
|
||||||
File parent = file.getParentFile();
|
File parent = file.getParentFile();
|
||||||
|
|
||||||
if (!parent.isDirectory() && !parent.mkdirs()) {
|
try {
|
||||||
Statics.LOGGER.error("Failed to create {}", parent);
|
Files.createDirectories(parent.toPath());
|
||||||
} else {
|
} catch (IOException e) {
|
||||||
try (OutputStream outputStream = Files.newOutputStream(file.toPath());
|
Statics.LOGGER.error("An exception occurred when trying to create {}", file, e);
|
||||||
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(outputStream)) {
|
}
|
||||||
IOUtils.copy(zipInputStream, bufferedOutputStream);
|
|
||||||
} catch (IOException e) {
|
try (OutputStream outputStream = Files.newOutputStream(file.toPath());
|
||||||
Statics.LOGGER.error("An exception occurred while trying to decompress file: {}", file.getName(), e);
|
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(outputStream)) {
|
||||||
}
|
IOUtils.copy(zipInputStream, bufferedOutputStream);
|
||||||
|
} catch (IOException e) {
|
||||||
|
Statics.LOGGER.error("An exception occurred while trying to decompress file: {}", file.getName(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue