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

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

commit 459d8c097b6757ae31262baf16bd77913f0cae07
Author: Andrea Cosentino <[email protected]>
AuthorDate: Wed Jan 28 12:46:04 2026 +0100

    Camel-AWS components: Use ObjectHelper for null checks - step function
    
    Signed-off-by: Andrea Cosentino <[email protected]>
---
 .../component/aws2/stepfunctions/StepFunctions2Component.java     | 3 ++-
 .../component/aws2/stepfunctions/StepFunctions2Endpoint.java      | 4 ++--
 .../component/aws2/stepfunctions/StepFunctions2Producer.java      | 8 ++++----
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git 
a/components/camel-aws/camel-aws2-step-functions/src/main/java/org/apache/camel/component/aws2/stepfunctions/StepFunctions2Component.java
 
b/components/camel-aws/camel-aws2-step-functions/src/main/java/org/apache/camel/component/aws2/stepfunctions/StepFunctions2Component.java
index 8ce37ac7d346..9641392c236e 100644
--- 
a/components/camel-aws/camel-aws2-step-functions/src/main/java/org/apache/camel/component/aws2/stepfunctions/StepFunctions2Component.java
+++ 
b/components/camel-aws/camel-aws2-step-functions/src/main/java/org/apache/camel/component/aws2/stepfunctions/StepFunctions2Component.java
@@ -23,6 +23,7 @@ import org.apache.camel.Endpoint;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.annotations.Component;
 import org.apache.camel.support.HealthCheckComponent;
+import org.apache.camel.util.ObjectHelper;
 
 @Component(value = "aws2-step-functions")
 public class StepFunctions2Component extends HealthCheckComponent {
@@ -41,7 +42,7 @@ public class StepFunctions2Component extends 
HealthCheckComponent {
     @Override
     protected Endpoint createEndpoint(String uri, String remaining, 
Map<String, Object> parameters) throws Exception {
         StepFunctions2Configuration configuration
-                = this.configuration != null ? this.configuration.copy() : new 
StepFunctions2Configuration();
+                = ObjectHelper.isNotEmpty(this.configuration) ? 
this.configuration.copy() : new StepFunctions2Configuration();
         StepFunctions2Endpoint endpoint = new StepFunctions2Endpoint(uri, 
this, configuration);
         setProperties(endpoint, parameters);
         if 
(Boolean.FALSE.equals(configuration.isUseDefaultCredentialsProvider())
diff --git 
a/components/camel-aws/camel-aws2-step-functions/src/main/java/org/apache/camel/component/aws2/stepfunctions/StepFunctions2Endpoint.java
 
b/components/camel-aws/camel-aws2-step-functions/src/main/java/org/apache/camel/component/aws2/stepfunctions/StepFunctions2Endpoint.java
index ad39d0374caa..03738f5b78e3 100644
--- 
a/components/camel-aws/camel-aws2-step-functions/src/main/java/org/apache/camel/component/aws2/stepfunctions/StepFunctions2Endpoint.java
+++ 
b/components/camel-aws/camel-aws2-step-functions/src/main/java/org/apache/camel/component/aws2/stepfunctions/StepFunctions2Endpoint.java
@@ -62,7 +62,7 @@ public class StepFunctions2Endpoint extends DefaultEndpoint 
implements EndpointS
     @Override
     public void doStart() throws Exception {
         super.doStart();
-        awsSfnClient = configuration.getAwsSfnClient() != null
+        awsSfnClient = ObjectHelper.isNotEmpty(configuration.getAwsSfnClient())
                 ? configuration.getAwsSfnClient()
                 : StepFunctions2ClientFactory.getSfnClient(configuration);
     }
@@ -71,7 +71,7 @@ public class StepFunctions2Endpoint extends DefaultEndpoint 
implements EndpointS
     public void doStop() throws Exception {
 
         if (ObjectHelper.isEmpty(configuration.getAwsSfnClient())) {
-            if (awsSfnClient != null) {
+            if (ObjectHelper.isNotEmpty(awsSfnClient)) {
                 awsSfnClient.close();
             }
         }
diff --git 
a/components/camel-aws/camel-aws2-step-functions/src/main/java/org/apache/camel/component/aws2/stepfunctions/StepFunctions2Producer.java
 
b/components/camel-aws/camel-aws2-step-functions/src/main/java/org/apache/camel/component/aws2/stepfunctions/StepFunctions2Producer.java
index 0dde2746e5da..d9194ee7e561 100644
--- 
a/components/camel-aws/camel-aws2-step-functions/src/main/java/org/apache/camel/component/aws2/stepfunctions/StepFunctions2Producer.java
+++ 
b/components/camel-aws/camel-aws2-step-functions/src/main/java/org/apache/camel/component/aws2/stepfunctions/StepFunctions2Producer.java
@@ -75,7 +75,7 @@ public class StepFunctions2Producer extends DefaultProducer {
     private StepFunctions2Operations determineOperation(Exchange exchange) {
         StepFunctions2Operations operation
                 = 
exchange.getIn().getHeader(StepFunctions2Constants.OPERATION, 
StepFunctions2Operations.class);
-        if (operation == null) {
+        if (ObjectHelper.isEmpty(operation)) {
             operation = getConfiguration().getOperation();
         }
         return operation;
@@ -87,7 +87,7 @@ public class StepFunctions2Producer extends DefaultProducer {
 
     @Override
     public String toString() {
-        if (sfnProducerToString == null) {
+        if (ObjectHelper.isEmpty(sfnProducerToString)) {
             sfnProducerToString = "StepFunctionsProducer[" + 
URISupport.sanitizeUri(getEndpoint().getEndpointUri()) + "]";
         }
         return sfnProducerToString;
@@ -710,7 +710,7 @@ public class StepFunctions2Producer extends DefaultProducer 
{
                 "producers",
                 WritableHealthCheckRepository.class);
 
-        if (healthCheckRepository != null) {
+        if (ObjectHelper.isNotEmpty(healthCheckRepository)) {
             String id = getEndpoint().getId();
             producerHealthCheck = new 
StepFunctions2ProducerHealthCheck(getEndpoint(), id);
             
producerHealthCheck.setEnabled(getEndpoint().getComponent().isHealthCheckProducerEnabled());
@@ -720,7 +720,7 @@ public class StepFunctions2Producer extends DefaultProducer 
{
 
     @Override
     protected void doStop() throws Exception {
-        if (healthCheckRepository != null && producerHealthCheck != null) {
+        if (ObjectHelper.isNotEmpty(healthCheckRepository) && 
ObjectHelper.isNotEmpty(producerHealthCheck)) {
             healthCheckRepository.removeHealthCheck(producerHealthCheck);
             producerHealthCheck = null;
         }

Reply via email to