Closed asegarra closed 3 years ago
Yes, I see your point:
finally {
IOUtils.closeQuietly(inputStream);
if (payload instanceof File && this.deleteFiles) {
final File filePayload = (File) payload;
if (!filePayload.delete() && logger.isWarnEnabled()) {
if (logger.isWarnEnabled()) {
logger.warn("failed to delete File '" + filePayload + "'");
}
}
}
}
it is really not OK to delete in the finally
when exception may happen in the main code.
Feel free to contribute the fix.
Thank you for catching this and raising an issue!
I found it odd that an exception being thrown from the unzipping process would still delete the original file making the situation a bit unexpected, I would have expected the deletion to occur only if the unzip was successful.