atiaomar1978-hub opened a new pull request, #25265: URL: https://github.com/apache/camel/pull/25265
## Summary _AI-generated on behalf of atiaomar1978-hub_ Fixes [CAMEL-24320](https://issues.apache.org/jira/browse/CAMEL-24320): with `-Dcamel.threads.virtual.enabled=true` on JDK 25+, Kamelet route creation failed during endpoint init with an NPE. **Root cause:** the JDK 25 `ScopedValue`-backed `ContextValue.orElse(null)` delegated to `ScopedValue.orElse`, which rejects a null fallback via `Objects.requireNonNull`. `DefaultCamelContextExtension.getCreateRoute()` / `getCreateProcessor()` call `orElse(null)` outside any binding scope (e.g. from `KameletComponent.doInit`). **Fix:** make `ScopedValueContextValue.orElse` null-tolerant — return the default when unbound instead of delegating to `ScopedValue.orElse`. ## Tests - `ScopedValueContextValueOrElseTest` (JDK 25+): direct regression for null/default/bound `orElse` on the ScopedValue backend - `CreateContextValueTest`: `getCreateRoute()` / `getCreateProcessor()` return null outside scope - `KameletVirtualThreadsRouteCreationTest` (JDK 25+): Main starts a route consuming `kamelet:vt-repro-source` with virtual threads enabled ## Test plan - [x] `mvn test -pl core/camel-util,core/camel-core,components/camel-kamelet -am -Dtest=ContextValueTest,ScopedValueContextValueOrElseTest,CreateContextValueTest,KameletVirtualThreadsRouteCreationTest` - [x] Bugbot review — no findings - [x] Grok review — production fix approved; primary guard is `ScopedValueContextValueOrElseTest` JIRA: https://issues.apache.org/jira/browse/CAMEL-24320 Made with [Cursor](https://cursor.com) -- 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]
