ing-mattioni commented on code in PR #11242:
URL: https://github.com/apache/nifi/pull/11242#discussion_r3257465451
##########
nifi-extension-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/PublishAMQP.java:
##########
@@ -317,9 +323,18 @@ private Map<String, Object>
validateAMQPHeaderProperty(final String amqpPropValu
for (String strEntry : strEntries) {
final String[] kv = strEntry.split("=", -1); // without using
limit, trailing delimiter would be ignored
if (kv.length == 2) {
- headers.put(kv[0].trim(), kv[1].trim());
+ final String key = kv[0].trim();
+ if (key.isEmpty()) {
+ getLogger().warn("Ignoring AMQP header property with empty
key: {}", strEntry);
+ continue;
+ }
+ headers.put(key, kv[1].trim());
} else if (kv.length == 1) {
- headers.put(kv[0].trim(), null);
+ final String key = kv[0].trim();
+ if (key.isEmpty()) {
+ continue;
+ }
+ headers.put(key, null);
Review Comment:
Extracted header insertion into a helper so empty keys are handled
consistently for both key=value and bare-key entries.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]