consistency

This commit is contained in:
szymon 2020-12-14 12:56:36 +01:00
parent 09b809de8f
commit 927638e0b6

View File

@ -51,14 +51,15 @@ public class ZipDecompressor {
} else {
File parent = file.getParentFile();
if (!parent.isDirectory() && !parent.mkdirs())
throw new IOException("Failed to create directory " + parent);
try (OutputStream outputStream = Files.newOutputStream(file.toPath());
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);
if (!parent.isDirectory() && !parent.mkdirs()) {
Statics.LOGGER.error("Failed to create {}", parent);
} else {
try (OutputStream outputStream = Files.newOutputStream(file.toPath());
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);
}
}
}
}