Skip to content

NPE due to getFromEndpoint #13

@furlongce

Description

@furlongce

https://www.javadoc.io/doc/org.apache.camel/camel-api/latest/org/apache/camel/Exchange.html

getFromEndpoint() - Returns the endpoint which originated this message exchange if a consumer on an endpoint created the message exchange, otherwise his property will be null.

I'm using this library w/ Apache Camel 3.13.0 and Spring Boot 2.5.x. I'm receiving a ton of NPEs since getFromEndpoint can be null, whenever a consumer on an endpoint didn't create the message exchange. This can be a problem when using direct routes, and I suspect it'll also be problematic when using forceCompletion via an AggregationController.

In general, I think it'd be safer to use getFromRouteId, though this can be null as well. However I haven't seen that happen yet in my testing.

I also noticed that all of the exchanges throwing an NPE already have a SpanId / TraceId assigned via the Exchange headers. Is there a reason that we need to create a new span at all? Or can we just use the possiblyExistingSpan?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions