davsclaus commented on code in PR #25771:
URL: https://github.com/apache/camel/pull/25771#discussion_r3864936674


##########
core/camel-support/src/main/java/org/apache/camel/support/AbstractExchange.java:
##########
@@ -496,7 +497,14 @@ public <T> T getIn(Class<T> type) {
         }
 
         // fallback to use type converter
-        return context.getTypeConverter().convertTo(type, this, in);
+        TypeConverter tc = context.getTypeConverter();
+        if (tc == null) {

Review Comment:
   This is the same pattern as the `getOut(Class)` guard below and the 
`ExchangeHelper` guard in #25760: a per-call-site null check. 
`getTypeConverter()` is called unguarded ~200 more times across `core/` — this 
doesn't close the race, it just moves the crash site. Prefer fixing this once 
at `DefaultCamelContextExtension.resetTypeConverter()` (sentinel converter that 
throws instead of `null`) rather than adding guards call-site by call-site.



##########
core/camel-support/src/main/java/org/apache/camel/support/AbstractExchange.java:
##########
@@ -550,7 +558,14 @@ public <T> T getOut(Class<T> type) {
         }
 
         // fallback to use type converter
-        return context.getTypeConverter().convertTo(type, this, out);
+        TypeConverter tc = context.getTypeConverter();
+        if (tc == null) {

Review Comment:
   Same concern as `getIn(Class)` above — see the top-level review comment for 
the suggested systemic fix.



##########
core/camel-support/pom.xml:
##########
@@ -71,6 +71,17 @@
             <artifactId>junit-jupiter</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.assertj</groupId>
+            <artifactId>assertj-core</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-core</artifactId>

Review Comment:
   This duplicates the identical `assertj-core`/`mockito-core` addition in the 
still-open #25760. If that merges first, this hunk will conflict — worth 
merging #25760 first and rebasing, or coordinating so the dependency addition 
only happens once. Also flagging: this is the first use of Mockito in 
`camel-support` (AssertJ is fine, already project-preferred).



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