nandorsoma commented on a change in pull request #5458:
URL: https://github.com/apache/nifi/pull/5458#discussion_r752041780
##########
File path:
nifi-nar-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/ConsumeAMQP.java
##########
@@ -192,6 +221,54 @@ private void addAttribute(final Map<String, String>
attributes, final String att
attributes.put(attributeName, value.toString());
}
+ private String buildHeaders(Map<String, Object> headers, boolean
escapeComma, boolean removeCurlyBraces) {
+ if (headers == null) {
+ return null;
+ }
+ if (escapeComma && removeCurlyBraces) {
+ return headers.keySet().stream()
+ .map(key -> key + "=" +
escapeString(headers.get(key).toString()))
+ .collect(Collectors.joining(", "));
+ } else if (escapeComma) {
+ return headers.keySet().stream()
+ .map(key -> key + "=" +
escapeString(headers.get(key).toString()))
+ .collect(Collectors.joining(", ", "{", "}"));
+ } else if (removeCurlyBraces) {
+ String headerString = headers.toString();
+ if(headerString.startsWith("{")){
Review comment:
Thank you for changing this. I hope it's not nitpicking but I think it
would be better to check for ending and closing characters together. This way
it's much more consistent and you can also spare a substring call by using the
original one. So, something like:
```
if (headerString.startsWith("{") && headerString.endsWith("}")) {
return headerString.substring(1, headerString.length() - 1);
}
```
Another option would be to construct the string here like in line 229
without escaping. This way it would be consistent code wise that we are only
relying on the Map.toString() in the original/compatible mode.
--
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]