S3-Source Bug Fix: Handle null object size for non S3-Create Events#5449
S3-Source Bug Fix: Handle null object size for non S3-Create Events#5449graytaylor0 merged 2 commits intoopensearch-project:mainfrom
Conversation
Signed-off-by: Jeremy Michael <jsusanto@amazon.com>
| 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.
Could you please add a test case?
There was a problem hiding this comment.
added a unit test
Signed-off-by: Jeremy Michael <jsusanto@amazon.com>
dlvenable
left a comment
There was a problem hiding this comment.
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. |
…pensearch-project#5449) Signed-off-by: Jeremy Michael <jsusanto@amazon.com>
…pensearch-project#5449) Signed-off-by: Jeremy Michael <jsusanto@amazon.com> Signed-off-by: George Chen <qchea@amazon.com>
…pensearch-project#5449) Signed-off-by: Jeremy Michael <jsusanto@amazon.com>
…pensearch-project#5449) Signed-off-by: Jeremy Michael <jsusanto@amazon.com>
…pensearch-project#5449) Signed-off-by: Jeremy Michael <jsusanto@amazon.com>
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.