mirror of https://github.com/apache/nifi.git
NIFI-6824 - Handling NPE of header value when consuming from Kafka
Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com> This closes #3859.
This commit is contained in:
parent
67fca6832a
commit
4b08cf116c
|
@ -497,8 +497,9 @@ public abstract class ConsumerLease implements Closeable, ConsumerRebalanceListe
|
|||
|
||||
for (final Header header : consumerRecord.headers()) {
|
||||
final String attributeName = header.key();
|
||||
if (headerNamePattern.matcher(attributeName).matches()) {
|
||||
attributes.put(attributeName, new String(header.value(), headerCharacterSet));
|
||||
final byte[] attributeValue = header.value();
|
||||
if (headerNamePattern.matcher(attributeName).matches() && attributeValue != null) {
|
||||
attributes.put(attributeName, new String(attributeValue, headerCharacterSet));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -497,8 +497,9 @@ public abstract class ConsumerLease implements Closeable, ConsumerRebalanceListe
|
|||
|
||||
for (final Header header : consumerRecord.headers()) {
|
||||
final String attributeName = header.key();
|
||||
if (headerNamePattern.matcher(attributeName).matches()) {
|
||||
attributes.put(attributeName, new String(header.value(), headerCharacterSet));
|
||||
final byte[] attributeValue = header.value();
|
||||
if (headerNamePattern.matcher(attributeName).matches() && attributeValue != null) {
|
||||
attributes.put(attributeName, new String(attributeValue, headerCharacterSet));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -497,8 +497,9 @@ public abstract class ConsumerLease implements Closeable, ConsumerRebalanceListe
|
|||
|
||||
for (final Header header : consumerRecord.headers()) {
|
||||
final String attributeName = header.key();
|
||||
if (headerNamePattern.matcher(attributeName).matches()) {
|
||||
attributes.put(attributeName, new String(header.value(), headerCharacterSet));
|
||||
final byte[] attributeValue = header.value();
|
||||
if (headerNamePattern.matcher(attributeName).matches() && attributeValue != null) {
|
||||
attributes.put(attributeName, new String(attributeValue, headerCharacterSet));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue