kevdoran commented on a change in pull request #5458: URL: https://github.com/apache/nifi/pull/5458#discussion_r737593262
########## File path: nifi-nar-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/ConsumeAMQP.java ########## @@ -184,6 +211,26 @@ protected void processResource(final Connection connection, final AMQPConsumer c return attributes; } + 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 + "=" + StringUtils.escapeString(headers.get(key).toString(), StringUtils.ESCAPE_CHAR, StringUtils.COMMA)) + .collect(Collectors.joining(", ")); + } else if (escapeComma) { + return headers.keySet().stream() + .map(key -> key + "=" + StringUtils.escapeString(headers.get(key).toString(), StringUtils.ESCAPE_CHAR, StringUtils.COMMA)) + .collect(Collectors.joining(", ", "{", "}")); + } else if (removeCurlyBraces) { + String headerString = headers.toString(); + return headerString.substring(1, headerString.length() - 1); Review comment: IMO, if `removeCurlyBraces==true`, but the headerString is not wrapped in curlyBraces, it should be a no-op. In other words, if someone enabled `removeCurlyBraces`, but the header value string does not contain leading/trailing braces, the header value string should be unaltered. -- 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: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org