Skip to content

Adds a null check when reading an S3EventNotification for records. So…#5933

Merged
dlvenable merged 1 commit into
opensearch-project:mainfrom
dlvenable:fix-s3-event-notification-parser
Jul 31, 2025
Merged

Adds a null check when reading an S3EventNotification for records. So…#5933
dlvenable merged 1 commit into
opensearch-project:mainfrom
dlvenable:fix-s3-event-notification-parser

Conversation

@dlvenable

Copy link
Copy Markdown
Member

Description

Some recent change has SqsWorkerTest failing. resulted in ObjectMapper::treeToValue return null for an empty string.

SqsWorkerTest > processSqsMessages_should_not_interact_with_S3Service_if_input_is_not_valid_JSON(String) > [1]  FAILED
    java.lang.NullPointerException: Cannot invoke "org.opensearch.dataprepper.plugins.source.s3.S3EventNotification.getRecords()" because "s3EventNotification" is null

SqsWorkerTest > WithSuccessfulDeletion > processSqsMessages_should_invoke_delete_if_input_is_not_valid_JSON_and_delete_on_error(String) > [1]  FAILED
    java.lang.NullPointerException: Cannot invoke "org.opensearch.dataprepper.plugins.source.s3.S3EventNotification.getRecords()" because "s3EventNotification" is null

Upon debugging I see that objectMapper.treeToValue(eventNode, S3EventNotification.class); is being called with an empty string and returning null.

The solution is to add a null check.

Issues Resolved

N/A

Check List

  • New functionality includes testing.
  • New functionality has a documentation issue. Please link to it in this PR.
    • New functionality has javadoc added
  • Commits are signed with a real name per the DCO

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.

…me recent change resulted in ObjectMapper::treeToValue return null for an empty string.

Signed-off-by: David Venable <dlv@amazon.com>
@dlvenable dlvenable merged commit 3662c25 into opensearch-project:main Jul 31, 2025
44 of 47 checks passed
@dlvenable dlvenable deleted the fix-s3-event-notification-parser branch August 1, 2025 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants