NIFI-4988 Changed to handle an invalid ZIP file#2725
NIFI-4988 Changed to handle an invalid ZIP file#2725apsaltis wants to merge 2 commits intoapache:masterfrom
Conversation
…ndled. When an invalid zip is processed, the exception is an IllegalArgumentException which was not being handled and thus the session was being rollbacked.
bdesert
left a comment
There was a problem hiding this comment.
+1 LGTM.
I've reproduced the issue with provided invalid zip file. After applying the patch, issue has been resolved, flowfile being transferred to "failure" as expected.
Also, since InvalidPathException extends IllegaArgumentException, it's correct to replace it in catch with full backward compatibility on original type of exception.
|
I think I'm missing something obvious... but the PR adds a new file, invalid_data.zip but it doesn't add it to the RAT exclusions in the pom.xml... yet, it still pass the contrib-check. I'm not sure why. |
| final List<MockFlowFile> unpacked = unpackRunner.getFlowFilesForRelationship(UnpackContent.REL_FAILURE); | ||
| for (final MockFlowFile flowFile : unpacked) { | ||
| final String filename = flowFile.getAttribute(CoreAttributes.FILENAME.key()); | ||
| // final String folder = flowFile.getAttribute(CoreAttributes.PATH.key()); |
There was a problem hiding this comment.
Can probably remove this line.
|
@markap14 i think often RAT can detect something is a binary file and not subject to having a license header. It can't hurt to add the exclusion but i think it is normal that rat isn't unhappy about it. |
|
Ah, ok, I didn't realize that @joewitt - I thought it had to always be excluded. There are probably a handful of well-known magic headers or something then. Good to know! |
|
also possible that I am totally full of it. One of these, possibly both, are true. |
…usions and changing exception handling to just catch Exception, this will avoid the potential of other RuntimeException from escaping and causing this issue to re-emerge in the near future
Changed the exception handling so that an invalid ZIP file is handled. When an invalid zip is processed, the exception is an IllegalArgumentException which was not being handled and thus the session was being rollbacked.
Thank you for submitting a contribution to Apache NiFi.
In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:
For all changes:
[X ] Is there a JIRA ticket associated with this PR? Is it referenced
in the commit message?
[X ] Does your PR title start with NIFI-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
[X ] Has your PR been rebased against the latest commit within the target branch (typically master)?
[ X] Is your initial contribution a single, squashed commit?
For code changes:
For documentation related changes:
Note:
Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.