logstash-integration-kafka 11.2.0-java → 11.2.1-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f4d4eeff4c13ac6151467cb7998742151a2829a18b05d6a74377edd7acab7fc
4
- data.tar.gz: 22fc71adaf29c11b9f0090436dc2e330a1a21eefc8fceb3aa4b4063f2adad626
3
+ metadata.gz: fa69555ca0e7780e4f9ffb16c0a3308396bab86436009695708b1c03c11a7a96
4
+ data.tar.gz: e28f2ac5e38ba7cb1289496b3c633756a2607f2d37fee36fd19cc44b8abedf93
5
5
  SHA512:
6
- metadata.gz: 4ae9306a90795f0d877e896ee79e2c7ecd46b1c7033bca2d3182a5b0b4dbc66b50502d23c39a70451b5a7b83013763232e8e7a8a5dba8958d237831e2808ce6a
7
- data.tar.gz: 5e4e48213df61f86cabf5e3535fc4f2c424714b904e12b0076812c832793b243ebbf54376edd90f9490e67f0a8268f290296be9570fa71704b626acd51ee92de
6
+ metadata.gz: fc63838c9baf545fffc3984e94faf73e72d8b97d7b4c04af12fc8de639ca55500b50255d1fcf7c6f684e49a2db763adccddb93a3df495301d66a8be769fae3f1
7
+ data.tar.gz: 540628833b9b3ab000046c07d5143812ce945de4788c58cb66680ff9c8e9d9ebdff8cb82042c52e0bbfa5a806b2deeb04ece1e8bc5e16b73edcf7f38c3be9901
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 11.2.1
2
+ - Fix nil exception to empty headers of record during event metadata assignment [#140](https://github.com/logstash-plugins/logstash-integration-kafka/pull/140)
3
+
1
4
  ## 11.2.0
2
5
  - Added TLS truststore and keystore settings specifically to access the schema registry [#137](https://github.com/logstash-plugins/logstash-integration-kafka/pull/137)
3
6
 
@@ -373,7 +373,9 @@ class LogStash::Inputs::Kafka < LogStash::Inputs::Base
373
373
  event.set("[@metadata][kafka][timestamp]", record.timestamp)
374
374
  end
375
375
  if @metadata_mode.include?(:headers)
376
- record.headers.each do |header|
376
+ record.headers
377
+ .select{|h| header_with_value(h) }
378
+ .each do |header|
377
379
  s = String.from_java_bytes(header.value)
378
380
  s.force_encoding(Encoding::UTF_8)
379
381
  if s.valid_encoding?
@@ -499,4 +501,8 @@ class LogStash::Inputs::Kafka < LogStash::Inputs::Base
499
501
  end
500
502
  end
501
503
 
504
+ def header_with_value(header)
505
+ !header.nil? && !header.value.nil? && !header.key.nil?
506
+ end
507
+
502
508
  end #class LogStash::Inputs::Kafka
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-integration-kafka'
3
- s.version = '11.2.0'
3
+ s.version = '11.2.1'
4
4
  s.licenses = ['Apache-2.0']
5
5
  s.summary = "Integration with Kafka - input and output plugins"
6
6
  s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline "+
@@ -287,6 +287,19 @@ describe LogStash::Inputs::Kafka do
287
287
  subject.register
288
288
  expect(subject.metadata_mode).to include(:record_props)
289
289
  end
290
+
291
+ context "guards against nil header" do
292
+ let(:header) { double(:value => nil, :key => "k") }
293
+ let(:headers) { [ header ] }
294
+ let(:record) { double(:headers => headers, :topic => "topic", :partition => 0,
295
+ :offset => 123456789, :key => "someId", :timestamp => nil ) }
296
+
297
+ it "does not raise error when key is nil" do
298
+ subject.register
299
+ evt = LogStash::Event.new('message' => 'Hello')
300
+ expect { subject.maybe_set_metadata(evt, record) }.not_to raise_error
301
+ end
302
+ end
290
303
  end
291
304
 
292
305
  context 'with client_rack' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-integration-kafka
3
3
  version: !ruby/object:Gem::Version
4
- version: 11.2.0
4
+ version: 11.2.1
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-14 00:00:00.000000000 Z
11
+ date: 2023-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement