lburgazzoli commented on a change in pull request #4887:
URL: https://github.com/apache/camel/pull/4887#discussion_r557900553



##########
File path: 
core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java
##########
@@ -3786,7 +3787,9 @@ public DataFormat resolveDataFormat(String name) {
         final DataFormat answer = dataformats.computeIfAbsent(name, new 
Function<String, DataFormat>() {
             @Override
             public DataFormat apply(String s) {
-                DataFormat df = 
ResolverHelper.lookupDataFormatInRegistryWithFallback(getCamelContextReference(),
 name);
+                DataFormat df = Optional
+                        
.ofNullable(ResolverHelper.lookupDataFormatInRegistryWithFallback(getCamelContextReference(),
 name))
+                        .orElse(getDataFormatResolver().createDataFormat(name, 
getCamelContextReference()));

Review comment:
       We can also remove the ternary operation on the `return`




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to