Skip to content
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

[BUG] Grok NPE fix when JacksonEvent.get() returns null #589

Merged

Conversation

graytaylor0
Copy link
Member

@graytaylor0 graytaylor0 commented Nov 13, 2021

Description

Grok Prepper was throwing a NPE when a key that did not exist in the event was attempted to match against. If possible, we should try to not have the JacksonEvent get() method return null when no node is found. We should try to return base values of the primitives at the very least, or use an Optional.

Issues Resolved

[List any issues this PR will resolve]

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

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.

@graytaylor0 graytaylor0 requested a review from a team as a code owner November 13, 2021 00:49
@graytaylor0 graytaylor0 changed the title Event model return null fix [BUG] Grok NPE fix when JacksonEvent.get() returns null Nov 13, 2021
@codecov-commenter
Copy link

Codecov Report

Merging #589 (8dd322e) into main (42c5954) will increase coverage by 0.17%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##               main     #589      +/-   ##
============================================
+ Coverage     92.12%   92.29%   +0.17%     
  Complexity      569      569              
============================================
  Files            71       71              
  Lines          1727     1727              
  Branches        144      144              
============================================
+ Hits           1591     1594       +3     
+ Misses          105      102       -3     
  Partials         31       31              
Impacted Files Coverage Δ
...java/com/amazon/dataprepper/pipeline/Pipeline.java 92.85% <0.00%> (+4.28%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 42c5954...8dd322e. Read the comment docs.

@dlvenable
Copy link
Member

I am for returning an Optional on the get. Thanks for making this fix.

@dlvenable dlvenable merged commit ea0db33 into opensearch-project:main Nov 13, 2021
@graytaylor0 graytaylor0 deleted the EventModelReturnNullFix branch November 16, 2021 03:56
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.

4 participants