56-bugfix
szymon 2021-01-23 18:46:49 +01:00
parent 2f55267ce2
commit 011283dc09
2 changed files with 38 additions and 18 deletions

View File

@ -50,13 +50,26 @@ public class GenericTarDecompressor {
File file = target.toPath().resolve(entry.getName()).toFile();
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 {
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()) {
Statics.LOGGER.error("Failed to create {}", parent);
} else {
Statics.LOGGER.error("Skipping: {}", file);
continue;
}*/
try (OutputStream outputStream = Files.newOutputStream(file.toPath());
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(outputStream)) {
IOUtils.copy(archiveInputStream, bufferedOutputStream);
@ -65,7 +78,6 @@ public class GenericTarDecompressor {
}
}
}
}
} catch (IOException | CompressorException e) {
Statics.LOGGER.error("An exception occurred! ", e);
}

View File

@ -47,13 +47,22 @@ public class ZipDecompressor {
File file = target.toPath().resolve(entry.getName()).toFile();
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 {
File parent = file.getParentFile();
if (!parent.isDirectory() && !parent.mkdirs()) {
Statics.LOGGER.error("Failed to create {}", parent);
} else {
try {
Files.createDirectories(parent.toPath());
} catch (IOException e) {
Statics.LOGGER.error("An exception occurred when trying to create {}", file, e);
}
try (OutputStream outputStream = Files.newOutputStream(file.toPath());
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(outputStream)) {
IOUtils.copy(zipInputStream, bufferedOutputStream);
@ -62,7 +71,6 @@ public class ZipDecompressor {
}
}
}
}
} catch (IOException e) {
Statics.LOGGER.error("An exception occurred! ", e);
}