mayurbm commented on PR #25554:
URL: https://github.com/apache/camel/pull/25554#issuecomment-5411124241

   Hi @davsclaus, thank you for the review — you were correct.
   
   **Reworked the fix to be narrowly scoped as you suggested.**
   
   The broad wrapping broke multiple tests across the codebase 
(`DefaultSupervisingRouteControllerTest`, `MainSupervisingRouteControllerTest`, 
`SpringSupervisingRouteControllerTest`, 
`NettyHttpTwoRoutesValidateBootstrapConfigurationTest`, 
`AiToolEndpointLifecycleTest`, `JmsTestConnectionOnStartupTest`, and others) 
because wrapping every exception changed the observable exception type for all 
callers.
   
   **Updated approach (both catch sites):**
   ```java
   catch (Exception e) {
       route.getProperties().put("route.start.exception", e);
       String msg = e.getMessage();
       if (msg == null || msg.isBlank()) {
           throw new FailedToStartRouteException(
                   routeService.getId(), routeService.getLocation(),
                   RouteService.extractUsefulMessage(e), e);
       }
       throw e;
   }
   ```
   Only wraps when the exception carries a null/blank message — the exact case 
CAMEL-24404 describes. Exceptions that already have a message propagate 
unchanged, preserving all existing behaviour.
   
   **Also:** removed the duplicate `extractUsefulMessage()` and now calls 
`RouteService.extractUsefulMessage(e)` directly (same package, already 
package-private static).
   
   **Changes: 2 files only**
   - `InternalRouteStartupManager.java` — narrow null-message guard at both 
catch sites
   - `InternalRouteStartupManagerConsumerStartTest.java` — 2 tests: bare NPE 
case + cause-chain walking with null-message wrapper
   
   Local validation:
   - `mvn formatter:format impsort:sort` — no changes needed
   - `InternalRouteStartupManagerConsumerStartTest`: Tests run: 2, Failures: 0
   - `DefaultSupervisingRouteControllerTest`: Tests run: 2, Failures: 0
   - `MainSupervisingRouteControllerTest`: Tests run: 3, Failures: 0
   - `SpringSupervisingRouteControllerTest`: Tests run: 1, Failures: 0
   - `NettyHttpTwoRoutesValidateBootstrapConfigurationTest`: Tests run: 1, 
Failures: 0
   - `AiToolEndpointLifecycleTest`: Tests run: 19, Failures: 0
   - `JmsTestConnectionOnStartupTest`: Tests run: 2, Failures: 0


-- 
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]

Reply via email to