mayurbm opened a new pull request, #25205: URL: https://github.com/apache/camel/pull/25205
## Summary `RouteService.warmUp()` and `setUp()` pass `e.getLocalizedMessage()` directly to `FailedToStartRouteException`, whose constructor calls `Objects.requireNonNull` on that argument. When the root cause is a message-less exception (bare `NullPointerException`, `StackOverflowError`, or a wrapped `WSDLException` whose inner cause has no text), `getLocalizedMessage()` returns `null` and a secondary `NullPointerException` is thrown from inside the `FailedToStartRouteException` constructor instead of the intended `FailedToStartRouteException`. This was first observed in Camel 3.14.x where the symptom was `Failed to start route X because of null`; the 4.x code fixed that regression but introduced this adjacent null-safety gap. ## Fix Adds a private `extractUsefulMessage(Throwable)` helper in `RouteService` that walks the cause chain for the first non-null, non-blank message and falls back to the exception simple class name. Both `warmUp()` and `setUp()` now call this helper instead of `e.getLocalizedMessage()` directly. ## Test `RouteServiceWarmUpNullMessageTest` added to `core/camel-core` covers: 1. A bare `NullPointerException` (no message) on warm-up does not cause a secondary NPE. 2. The resulting exception message never contains `because: null`. 3. When the outer exception has no message but a nested cause does, the cause message is surfaced. ## 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) -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
