zf.entries().asIterator().forEachRemaining(zipProcessingFunction.getProcessZipConsumer(csarPackagePath, zf, zos));
} catch (final IOException ex1) {
rollback(reducedCsarPath);
+ LOGGER.error("Could not read ZIP stream '{}'", csarPackagePath.toString(), ex1);
final var errorMsg = String.format(UNEXPECTED_PROBLEM_HAPPENED_WHILE_READING_THE_CSAR, csarPackagePath);
throw new CsarSizeReducerException(errorMsg, ex1);
}
reducedCsarBytes = Files.readAllBytes(csarPackagePath);
}
} catch (final IOException e) {
+ LOGGER.error("Could not read bytes of file '{}'", csarPackagePath, e);
final var errorMsg = String.format("Could not read bytes of file '%s'", csarPackagePath);
throw new CsarSizeReducerException(errorMsg, e);
}
try {
Files.delete(reducedCsarPath);
} catch (final IOException e) {
+ LOGGER.error("Could not delete temporary file '{}'", reducedCsarPath, e);
final var errorMsg = String.format("Could not delete temporary file '%s'", reducedCsarPath);
throw new CsarSizeReducerException(errorMsg, e);
}
final var entryName = zipEntry.getName();
try {
if (totalEntryArchive.getAndIncrement() > thresholdEntries) {
- // too much entries in this archive, can lead to inodes exhaustion of the system
+ LOGGER.warn("too many entries in this archive, can lead to inodes exhaustion of the system");
+ // too many entries in this archive, can lead to inodes exhaustion of the system
final var errorMsg = String.format("Failed to extract '%s' from zip '%s'", entryName, csarPackagePath);
throw new CsarSizeReducerException(errorMsg);
}
}
zos.closeEntry();
} catch (final IOException ei) {
+ LOGGER.error("Failed to extract '{}' from zip '{}'", entryName, csarPackagePath, ei);
final var errorMsg = String.format("Failed to extract '%s' from zip '%s'", entryName, csarPackagePath);
throw new CsarSizeReducerException(errorMsg, ei);
}
return zipEntry -> {
final var entryName = zipEntry.getName();
if (totalEntryArchive.getAndIncrement() > thresholdEntries) {
- // too much entries in this archive, can lead to inodes exhaustion of the system
+ LOGGER.warn("too many entries in this archive, can lead to inodes exhaustion of the system");
+ // too many entries in this archive, can lead to inodes exhaustion of the system
final var errorMsg = String.format("Failed to extract '%s' from zip '%s'", entryName, csarPackagePath);
throw new CsarSizeReducerException(errorMsg);
}
}
zos.closeEntry();
} catch (final IOException ei) {
+ LOGGER.error("Failed to extract '{}' from zip '{}'", entryName, csarPackagePath, ei);
final var errorMsg = String.format("Failed to extract '%s' from zip '%s'", entryName, csarPackagePath);
throw new CsarSizeReducerException(errorMsg, ei);
}
if (Files.exists(reducedCsarPath)) {
try {
Files.delete(reducedCsarPath);
- } catch (final Exception ex2) {
- LOGGER.warn("Could not delete temporary file '{}'", reducedCsarPath, ex2);
+ } catch (final Exception e) {
+ LOGGER.warn("Could not delete temporary file '{}'", reducedCsarPath, e);
}
}
}
.map(ZipEntry::getName).map(Path::of)
.collect(Collectors.toList());
} catch (final IOException e) {
+ LOGGER.error("Failed to read ZipFile '{}'", csarPackagePath.toString(), e);
final var errorMsg = String.format(UNEXPECTED_PROBLEM_HAPPENED_WHILE_READING_THE_CSAR, csarPackagePath);
throw new CsarSizeReducerException(errorMsg, e);
}