This is an automated email from the ASF dual-hosted git repository.

Croway pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 9461609a7132 CAMEL-24186: camel-cxf - code-quality cleanup
9461609a7132 is described below

commit 9461609a713222ce79dcc91d7702fa0c5fac5134
Author: croway <[email protected]>
AuthorDate: Thu Jul 16 15:52:54 2026 +0200

    CAMEL-24186: camel-cxf - code-quality cleanup
    
    Behaviour-preserving cleanups from the July 2026 camel-cxf review:
    
    - CxfConverter: use Locale.ROOT in toDataFormat toUpperCase (locale-safe)
    - CxfRsInvoker: fix misspelled SUSPENED constant -> SUSPENDED
    - CxfRsProducer: drop discarded sfb.getResourceClasses() calls
    - CxfConsumer: remove no-op out-fault observer wrapper (and unused import)
    - SpringBusFactoryBean: make bf a local variable instead of a field
    - CxfMessageMapper: fix Javadoc link to a non-existent class
---
 .../java/org/apache/camel/component/cxf/jaxrs/CxfConverter.java   | 3 ++-
 .../java/org/apache/camel/component/cxf/jaxrs/CxfRsInvoker.java   | 8 ++++----
 .../java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java  | 2 --
 .../java/org/apache/camel/component/cxf/jaxws/CxfConsumer.java    | 6 ------
 .../apache/camel/component/cxf/spring/SpringBusFactoryBean.java   | 3 +--
 .../camel/component/cxf/transport/message/CxfMessageMapper.java   | 2 +-
 6 files changed, 8 insertions(+), 16 deletions(-)

diff --git 
a/components/camel-cxf/camel-cxf-rest/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfConverter.java
 
b/components/camel-cxf/camel-cxf-rest/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfConverter.java
index 59fb8078fc02..da90d9c89264 100644
--- 
a/components/camel-cxf/camel-cxf-rest/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfConverter.java
+++ 
b/components/camel-cxf/camel-cxf-rest/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfConverter.java
@@ -22,6 +22,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Locale;
 import java.util.Map;
 import java.util.TreeMap;
 
@@ -105,7 +106,7 @@ public final class CxfConverter {
 
     @Converter
     public static DataFormat toDataFormat(final String name) {
-        return DataFormat.valueOf(name.toUpperCase());
+        return DataFormat.valueOf(name.toUpperCase(Locale.ROOT));
     }
 
     @Converter(allowNull = true)
diff --git 
a/components/camel-cxf/camel-cxf-rest/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsInvoker.java
 
b/components/camel-cxf/camel-cxf-rest/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsInvoker.java
index 47f914aba77b..dec381a8fcf3 100644
--- 
a/components/camel-cxf/camel-cxf-rest/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsInvoker.java
+++ 
b/components/camel-cxf/camel-cxf-rest/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsInvoker.java
@@ -42,7 +42,7 @@ import org.slf4j.LoggerFactory;
 
 public class CxfRsInvoker extends JAXRSInvoker {
     private static final Logger LOG = 
LoggerFactory.getLogger(CxfRsInvoker.class);
-    private static final String SUSPENED = 
"org.apache.camel.component.cxf.jaxrs.suspend";
+    private static final String SUSPENDED = 
"org.apache.camel.component.cxf.jaxrs.suspend";
     private final CxfRsConsumer cxfRsConsumer;
     private final CxfRsEndpoint endpoint;
 
@@ -95,7 +95,7 @@ public class CxfRsInvoker extends JAXRSInvoker {
                 LOG.trace("Suspending continuation of exchangeId: {}", 
camelExchange.getExchangeId());
                 // The continuation could be called before the suspend is 
called
                 continuation.suspend(endpoint.getContinuationTimeout());
-                cxfExchange.put(SUSPENED, Boolean.TRUE);
+                cxfExchange.put(SUSPENDED, Boolean.TRUE);
                 continuation.setObject(camelExchange);
                 cxfRsConsumer.getAsyncProcessor().process(camelExchange, new 
AsyncCallback() {
                     public void done(boolean doneSync) {
@@ -110,7 +110,7 @@ public class CxfRsInvoker extends JAXRSInvoker {
                 return null;
             }
             if (!continuation.isTimeout() && continuation.isResumed()) {
-                cxfExchange.put(SUSPENED, Boolean.FALSE);
+                cxfExchange.put(SUSPENDED, Boolean.FALSE);
                 org.apache.camel.Exchange camelExchange = 
(org.apache.camel.Exchange) continuation.getObject();
                 try {
                     return returnResponse(cxfExchange, camelExchange);
@@ -120,7 +120,7 @@ public class CxfRsInvoker extends JAXRSInvoker {
                 }
             } else {
                 if (continuation.isTimeout() || !continuation.isPending()) {
-                    cxfExchange.put(SUSPENED, Boolean.FALSE);
+                    cxfExchange.put(SUSPENDED, Boolean.FALSE);
                     org.apache.camel.Exchange camelExchange = 
(org.apache.camel.Exchange) continuation.getObject();
                     camelExchange.setException(new 
ExchangeTimedOutException(camelExchange, endpoint.getContinuationTimeout()));
                     try {
diff --git 
a/components/camel-cxf/camel-cxf-rest/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
 
b/components/camel-cxf/camel-cxf-rest/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
index 416f079cc10c..84c5e7eb7b48 100644
--- 
a/components/camel-cxf/camel-cxf-rest/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
+++ 
b/components/camel-cxf/camel-cxf-rest/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
@@ -212,7 +212,6 @@ public class CxfRsProducer extends DefaultAsyncProducer {
 
         // find out the method which we want to invoke
         JAXRSServiceFactoryBean sfb = cfb.getServiceFactory();
-        sfb.getResourceClasses();
         // check the null body first
         Object[] parameters = null;
         if (inMessage.getBody() != null) {
@@ -465,7 +464,6 @@ public class CxfRsProducer extends DefaultAsyncProducer {
 
         // find out the method which we want to invoke
         JAXRSServiceFactoryBean sfb = cfb.getServiceFactory();
-        sfb.getResourceClasses();
         // check the null body first
         Object[] parameters = null;
         if (inMessage.getBody() != null) {
diff --git 
a/components/camel-cxf/camel-cxf-soap/src/main/java/org/apache/camel/component/cxf/jaxws/CxfConsumer.java
 
b/components/camel-cxf/camel-cxf-soap/src/main/java/org/apache/camel/component/cxf/jaxws/CxfConsumer.java
index 505e8bda9a01..73a43095ba4b 100644
--- 
a/components/camel-cxf/camel-cxf-soap/src/main/java/org/apache/camel/component/cxf/jaxws/CxfConsumer.java
+++ 
b/components/camel-cxf/camel-cxf-soap/src/main/java/org/apache/camel/component/cxf/jaxws/CxfConsumer.java
@@ -53,7 +53,6 @@ import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.service.invoker.Invoker;
 import org.apache.cxf.service.model.BindingOperationInfo;
-import org.apache.cxf.transport.MessageObserver;
 import org.apache.cxf.ws.addressing.ContextUtils;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 import org.slf4j.Logger;
@@ -94,11 +93,6 @@ public class CxfConsumer extends DefaultConsumer implements 
Suspendable {
             
ret.getEndpoint().getEndpointInfo().setProperty("publishedEndpointUrl", 
cxfEndpoint.getPublishedEndpointUrl());
         }
 
-        final MessageObserver originalOutFaultObserver = 
ret.getEndpoint().getOutFaultObserver();
-        ret.getEndpoint().setOutFaultObserver(message -> {
-            originalOutFaultObserver.onMessage(message);
-        });
-
         // setup the UnitOfWorkCloserInterceptor for OneWayMessageProcessor
         ret.getEndpoint().getInInterceptors().add(new 
UnitOfWorkCloserInterceptor(Phase.POST_INVOKE, true));
         // close the UnitOfWork normally
diff --git 
a/components/camel-cxf/camel-cxf-spring-common/src/main/java/org/apache/camel/component/cxf/spring/SpringBusFactoryBean.java
 
b/components/camel-cxf/camel-cxf-spring-common/src/main/java/org/apache/camel/component/cxf/spring/SpringBusFactoryBean.java
index 67bf0ba7d39c..9895e66d1dc8 100644
--- 
a/components/camel-cxf/camel-cxf-spring-common/src/main/java/org/apache/camel/component/cxf/spring/SpringBusFactoryBean.java
+++ 
b/components/camel-cxf/camel-cxf-spring-common/src/main/java/org/apache/camel/component/cxf/spring/SpringBusFactoryBean.java
@@ -32,11 +32,10 @@ import org.springframework.beans.factory.SmartFactoryBean;
 public class SpringBusFactoryBean implements SmartFactoryBean<Bus> {
     private String[] cfgFiles;
     private boolean includeDefaultBus;
-    private SpringBusFactory bf;
 
     @Override
     public Bus getObject() throws Exception {
-        bf = new SpringBusFactory();
+        SpringBusFactory bf = new SpringBusFactory();
         if (cfgFiles != null) {
             return bf.createBus(cfgFiles, includeDefaultBus);
         } else {
diff --git 
a/components/camel-cxf/camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/transport/message/CxfMessageMapper.java
 
b/components/camel-cxf/camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/transport/message/CxfMessageMapper.java
index 91ac5573e595..6544fca0f7f0 100644
--- 
a/components/camel-cxf/camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/transport/message/CxfMessageMapper.java
+++ 
b/components/camel-cxf/camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/transport/message/CxfMessageMapper.java
@@ -21,7 +21,7 @@ import org.apache.camel.spi.HeaderFilterStrategy;
 import org.apache.cxf.message.Message;
 
 /**
- * A Strategy to bind a Camel exchange to a CXF message used by {@link 
CxfBeanDestination}.
+ * A Strategy to bind a Camel exchange to a CXF message, used by the Camel CXF 
transport.
  */
 public interface CxfMessageMapper {
 

Reply via email to