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 e8781e8b8f88f1ab1e22ad730487c16dabcf7558
Author: Andrea Cosentino <[email protected]>
AuthorDate: Wed Jan 28 12:47:59 2026 +0100

    Camel-AWS components: Use ObjectHelper for null checks - Textract
    
    Signed-off-by: Andrea Cosentino <[email protected]>
---
 .../camel/component/aws2/textract/Textract2Component.java  |  3 ++-
 .../camel/component/aws2/textract/Textract2Endpoint.java   |  4 ++--
 .../camel/component/aws2/textract/Textract2Producer.java   | 14 +++++++-------
 3 files changed, 11 insertions(+), 10 deletions(-)

diff --git 
a/components/camel-aws/camel-aws2-textract/src/main/java/org/apache/camel/component/aws2/textract/Textract2Component.java
 
b/components/camel-aws/camel-aws2-textract/src/main/java/org/apache/camel/component/aws2/textract/Textract2Component.java
index 98f61260d990..735cc6a2a682 100644
--- 
a/components/camel-aws/camel-aws2-textract/src/main/java/org/apache/camel/component/aws2/textract/Textract2Component.java
+++ 
b/components/camel-aws/camel-aws2-textract/src/main/java/org/apache/camel/component/aws2/textract/Textract2Component.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;
 
 /**
  * For working with Amazon Textract SDK v2.
@@ -44,7 +45,7 @@ public class Textract2Component extends HealthCheckComponent {
     @Override
     protected Endpoint createEndpoint(String uri, String remaining, 
Map<String, Object> parameters) throws Exception {
         Textract2Configuration configuration
-                = this.configuration != null ? this.configuration.copy() : new 
Textract2Configuration();
+                = ObjectHelper.isNotEmpty(this.configuration) ? 
this.configuration.copy() : new Textract2Configuration();
 
         Textract2Endpoint endpoint = new Textract2Endpoint(uri, this, 
configuration);
         setProperties(endpoint, parameters);
diff --git 
a/components/camel-aws/camel-aws2-textract/src/main/java/org/apache/camel/component/aws2/textract/Textract2Endpoint.java
 
b/components/camel-aws/camel-aws2-textract/src/main/java/org/apache/camel/component/aws2/textract/Textract2Endpoint.java
index 3ffb0e8b0759..b1abe44061ce 100644
--- 
a/components/camel-aws/camel-aws2-textract/src/main/java/org/apache/camel/component/aws2/textract/Textract2Endpoint.java
+++ 
b/components/camel-aws/camel-aws2-textract/src/main/java/org/apache/camel/component/aws2/textract/Textract2Endpoint.java
@@ -66,7 +66,7 @@ public class Textract2Endpoint extends ScheduledPollEndpoint 
implements Endpoint
         super.doStart();
 
         textractClient
-                = configuration.getTextractClient() != null
+                = ObjectHelper.isNotEmpty(configuration.getTextractClient())
                         ? configuration.getTextractClient()
                         : 
Textract2ClientFactory.getTextractClient(configuration);
     }
@@ -74,7 +74,7 @@ public class Textract2Endpoint extends ScheduledPollEndpoint 
implements Endpoint
     @Override
     public void doStop() throws Exception {
         if (ObjectHelper.isEmpty(configuration.getTextractClient())) {
-            if (textractClient != null) {
+            if (ObjectHelper.isNotEmpty(textractClient)) {
                 textractClient.close();
             }
         }
diff --git 
a/components/camel-aws/camel-aws2-textract/src/main/java/org/apache/camel/component/aws2/textract/Textract2Producer.java
 
b/components/camel-aws/camel-aws2-textract/src/main/java/org/apache/camel/component/aws2/textract/Textract2Producer.java
index 7a696da02ef2..2ea9c374427d 100644
--- 
a/components/camel-aws/camel-aws2-textract/src/main/java/org/apache/camel/component/aws2/textract/Textract2Producer.java
+++ 
b/components/camel-aws/camel-aws2-textract/src/main/java/org/apache/camel/component/aws2/textract/Textract2Producer.java
@@ -87,7 +87,7 @@ public class Textract2Producer extends DefaultProducer {
 
     private Textract2Operations determineOperation(Exchange exchange) {
         Textract2Operations operation = 
exchange.getIn().getHeader(Textract2Constants.OPERATION, 
Textract2Operations.class);
-        if (operation == null) {
+        if (ObjectHelper.isEmpty(operation)) {
             operation = getConfiguration().getOperation();
         }
         return operation;
@@ -99,7 +99,7 @@ public class Textract2Producer extends DefaultProducer {
 
     @Override
     public String toString() {
-        if (textractProducerToString == null) {
+        if (ObjectHelper.isEmpty(textractProducerToString)) {
             textractProducerToString = "TextractProducer[" + 
URISupport.sanitizeUri(getEndpoint().getEndpointUri()) + "]";
         }
         return textractProducerToString;
@@ -343,7 +343,7 @@ public class Textract2Producer extends DefaultProducer {
             request.jobId(jobId);
 
             Integer maxResults = 
exchange.getIn().getHeader(Textract2Constants.MAX_RESULTS, Integer.class);
-            if (maxResults != null) {
+            if (ObjectHelper.isNotEmpty(maxResults)) {
                 request.maxResults(maxResults);
             }
 
@@ -391,7 +391,7 @@ public class Textract2Producer extends DefaultProducer {
             request.jobId(jobId);
 
             Integer maxResults = 
exchange.getIn().getHeader(Textract2Constants.MAX_RESULTS, Integer.class);
-            if (maxResults != null) {
+            if (ObjectHelper.isNotEmpty(maxResults)) {
                 request.maxResults(maxResults);
             }
 
@@ -439,7 +439,7 @@ public class Textract2Producer extends DefaultProducer {
             request.jobId(jobId);
 
             Integer maxResults = 
exchange.getIn().getHeader(Textract2Constants.MAX_RESULTS, Integer.class);
-            if (maxResults != null) {
+            if (ObjectHelper.isNotEmpty(maxResults)) {
                 request.maxResults(maxResults);
             }
 
@@ -541,7 +541,7 @@ public class Textract2Producer extends DefaultProducer {
                 "producers",
                 WritableHealthCheckRepository.class);
 
-        if (healthCheckRepository != null) {
+        if (ObjectHelper.isNotEmpty(healthCheckRepository)) {
             String id = getEndpoint().getId();
             producerHealthCheck = new 
Textract2ProducerHealthCheck(getEndpoint(), id);
             
producerHealthCheck.setEnabled(getEndpoint().getComponent().isHealthCheckProducerEnabled());
@@ -551,7 +551,7 @@ public class Textract2Producer 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