mayurbm commented on PR #25760: URL: https://github.com/apache/camel/pull/25760#issuecomment-5423548231
## JIRA: CAMEL-24510 https://issues.apache.org/jira/browse/CAMEL-24510 **Summary:** `ExchangeHelper.convertToType()` and `convertToMandatoryType()` throw a bare `NullPointerException` when `CamelContext.getTypeConverter()` returns `null` during context shutdown/restart or when the type converter registry has been cleared. **Root cause:** No null guard on the result of `getTypeConverter()` in `ExchangeHelper.java` line 261/274. **Fix:** Null guards in both methods with a descriptive `IllegalStateException` identifying from/to types and reason. Fast-path short-circuits for null value and already-correct-type cases in `convertToType`. **Local validation:** - `mvn formatter:format impsort:sort` — no changes needed - `ExchangeHelperNullTypeConverterTest`: Tests run: 5, 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]
