-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
S3-Source Bug Fix: Handle null object size for non S3-Create Events #5449
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Jeremy Michael <[email protected]>
@@ -37,7 +37,8 @@ public ParsedMessage(final Message message, final boolean failedParsing) { | |||
// S3EventNotification contains only one S3EventNotificationRecord | |||
this.bucketName = notificationRecords.get(0).getS3().getBucket().getName(); | |||
this.objectKey = notificationRecords.get(0).getS3().getObject().getUrlDecodedKey(); | |||
this.objectSize = notificationRecords.get(0).getS3().getObject().getSizeAsLong(); | |||
Long size = notificationRecords.get(0).getS3().getObject().getSizeAsLong(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add a test case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added a unit test
Signed-off-by: Jeremy Michael <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually thought we had code that filtered out the events so that only created events were processed.
@dlvenable The issue is that we're calling final |
Were you able to confirm that with this change a DeleteEvent did not hit an error and the SQS message for it was deleted? |
@graytaylor0 After this change, we don't hit an error and DeleteEvent messages get deleted. The issue was primarily during the creation of the ParsedMessages. |
Description
This PR fixes a NullPointerException that occurs when processing non S3-create events such as S3-delete due to the absence of an object size in the event notification. The
getSizeAsLong()
method can return null for delete events, which caused the application to throw an error.Issues Resolved
Resolves #5448
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.