-
Notifications
You must be signed in to change notification settings - Fork 61
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
Fix nil exception to empty headers during metadata assignment #140
Fix nil exception to empty headers during metadata assignment #140
Conversation
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.
Tried locally and I think the test doesn't exercise the code, plus a minor suggestion to make it more declarative
lib/logstash/inputs/kafka.rb
Outdated
@@ -374,6 +374,8 @@ def maybe_set_metadata(event, record) | |||
end | |||
if @metadata_mode.include?(:headers) | |||
record.headers.each do |header| | |||
next if header.nil? || header.value.nil? || header.key.nil? |
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 tried to comment this line and ran the test, but was still green. Seems the test doesn't enter the loop.
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.
Great that you spot it
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.
Once it's green, LGTM!
Fix: #141
This commit guard nil exception in metadata assignment