[
https://issues.apache.org/jira/browse/CAMEL-24350?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Work on CAMEL-24350 started by Andrea Cosentino.
------------------------------------------------
> camel-google-pubsub: producer NPEs on non-convertible headers and drops
> non-Exchange list elements
> --------------------------------------------------------------------------------------------------
>
> Key: CAMEL-24350
> URL: https://issues.apache.org/jira/browse/CAMEL-24350
> Project: Camel
> Issue Type: Bug
> Components: camel-google-pubsub
> Reporter: Andrea Cosentino
> Assignee: Andrea Cosentino
> Priority: Minor
>
> 1. Header pass-through can hand protobuf a null value:
> {code:java}
> // GooglePubsubProducer.java:126-133
> for (String camelHeader : exchange.getIn().getHeaders().keySet()) {
> String value = exchange.getIn().getHeader(camelHeader, String.class);
> if (headerFilterStrategy != null &&
> headerFilterStrategy.applyFilterToCamelHeaders(camelHeader, value, exchange))
> {
> continue;
> }
> messageBuilder.putAttributes(camelHeader, value);
> }
> {code}
> {{putAttributes}} rejects null, so a header whose value is null or does not
> convert to String aborts the send with an NPE. The filter strategy is also
> consulted with a null value.
> 2. A List body that mixes exchanges and plain payloads silently drops the
> plain ones:
> {code:java}
> // GooglePubsubProducer.java:72-82
> if (exchange.getIn().getBody() instanceof List) {
> boolean groupedExchanges = false;
> for (Object body : exchange.getIn().getBody(List.class)) {
> if (body instanceof Exchange) { send((Exchange) body);
> groupedExchanges = true; }
> }
> if (!groupedExchanges) { send(exchange); }
> }
> {code}
> Non-Exchange elements are never published when at least one element is an
> Exchange. The same shape exists in {{consumer/AcknowledgeSync:72-76}}.
> Found during a source audit of the {{components/camel-google}} module family
> against main @ c3b01310be15.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)