Federico Mariani created CAMEL-23985:
----------------------------------------
Summary: camel-yaml-dsl - Pipe preConfigurePipe lacks validation:
unsupported ref kinds yield null/"null?params" endpoint URIs, NPE on sink
without endpoint, IOOBE on empty errorHandler
Key: CAMEL-23985
URL: https://issues.apache.org/jira/browse/CAMEL-23985
Project: Camel
Issue Type: Bug
Components: camel-yaml-dsl
Affects Versions: 4.21.0
Reporter: Federico Mariani
Three robustness gaps in {{YamlRoutesBuilderLoader}}'s Pipe handling, all
producing late or context-free failures instead of positioned YAML errors:
h3. 1. Unsupported ref kinds silently produce null endpoint URIs (lines
417-418, 494-495, 586-611)
{{extractCamelEndpointUri}} only recognizes Kamelet, Strimzi {{KafkaTopic}},
and Knative {{Broker}}/{{Channel}} refs. Any other ref kind (e.g. Knative
Serving {{kind: Service}}, common in Pipes on Kubernetes) falls back to
{{extractTupleValue(node.getValue(), "uri")}} which is null for ref-style
endpoints. Then:
* {{route.from(null)}} / {{new ToDefinition(null)}} fails much later at route
initialization with a message that never mentions the unsupported ref;
* if the ref has {{properties}}, line 610's string concatenation produces the
literal endpoint {{"null?key=value"}} (Java null + "?"), failing as unknown
component "null".
Expected: a clear "unsupported ref kind" error naming the apiVersion/kind.
h3. 2. NPE when errorHandler sink has no endpoint (lines 518-519, failing at
571)
{code:yaml}
spec:
errorHandler:
sink:
parameters: {...} # endpoint omitted
{code}
{{asMappingNode(nodeAt(...))}} returns null and
{{extractCamelEndpointUri(null)}} NPEs ({{YamlDeserializerSupport.nodeAt}}
dereferences the null mapping) — a raw NullPointerException with no file/line
context instead of "sink error handler requires an endpoint".
h3. 3. IndexOutOfBoundsException on empty errorHandler mapping (line 511)
{{errorHandler.getValue().get(0)}} assumes at least one tuple;
{{spec.errorHandler: {}}} throws {{IndexOutOfBoundsException: Index 0 out of
bounds}} with no resource/line context. The node's start mark is available and
should be used in a proper validation error.
_Filed by Claude Code on behalf of Croway._
--
This message was sent by Atlassian Jira
(v8.20.10#820010)