Prasanth Ganesh Rao created CAMEL-24301:
-------------------------------------------
Summary: RouteService NPE when startup-failure exception has no
message
Key: CAMEL-24301
URL: https://issues.apache.org/jira/browse/CAMEL-24301
Project: Camel
Issue Type: Bug
Components: camel-base-engine, camel-core
Reporter: Prasanth Ganesh Rao
When a route fails to start and the root cause exception carries no message
(e.g. bare NullPointerException, StackOverflowError, or a wrapped WSDLException
with no text), RouteService.warmUp() and setUp() pass e.getLocalizedMessage()
directly to FailedToStartRouteException. That constructor calls
Objects.requireNonNull on the message argument, so a secondary NPE is thrown
from inside FailedToStartRouteException
instead of the intended exception.
In Camel 3.14.x this manifested as "Failed to start route X because of null";
the 4.x code fixed that regression but left this adjacent null-safety gap.
*Fix (PR #25205):*
A private extractUsefulMessage(Throwable) helper is added to RouteService
that walks the cause chain for the first non-null, non-blank message and falls
back to the exception's simple class name. Both warmUp() and setUp() now call
this helper instead of getLocalizedMessage() directly.
*Files changed:*
-
core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/RouteService.java
-
core/camel-core/src/test/java/org/apache/camel/impl/engine/RouteServiceWarmUpNullMessageTest.java
(new)
PR: https://github.com/apache/camel/pull/25205
--
This message was sent by Atlassian Jira
(v8.20.10#820010)