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

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

commit 5b12740338b8e401ab904abfcb8a9b6c08894f22
Author: Andrea Cosentino <[email protected]>
AuthorDate: Wed Jan 28 12:50:05 2026 +0100

    Camel-AWS components: Use ObjectHelper for null checks - Timestream
    
    Signed-off-by: Andrea Cosentino <[email protected]>
---
 .../camel/component/aws2/timestream/Timestream2Component.java     | 3 ++-
 .../component/aws2/timestream/query/Timestream2QueryEndpoint.java | 4 ++--
 .../component/aws2/timestream/query/Timestream2QueryProducer.java | 8 ++++----
 .../component/aws2/timestream/write/Timestream2WriteEndpoint.java | 4 ++--
 .../component/aws2/timestream/write/Timestream2WriteProducer.java | 8 ++++----
 5 files changed, 14 insertions(+), 13 deletions(-)

diff --git 
a/components/camel-aws/camel-aws2-timestream/src/main/java/org/apache/camel/component/aws2/timestream/Timestream2Component.java
 
b/components/camel-aws/camel-aws2-timestream/src/main/java/org/apache/camel/component/aws2/timestream/Timestream2Component.java
index 5e1dd4ee97bb..0bc1ed7b0447 100644
--- 
a/components/camel-aws/camel-aws2-timestream/src/main/java/org/apache/camel/component/aws2/timestream/Timestream2Component.java
+++ 
b/components/camel-aws/camel-aws2-timestream/src/main/java/org/apache/camel/component/aws2/timestream/Timestream2Component.java
@@ -25,6 +25,7 @@ import 
org.apache.camel.component.aws2.timestream.write.Timestream2WriteEndpoint
 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-timestream")
 public class Timestream2Component extends HealthCheckComponent {
@@ -43,7 +44,7 @@ public class Timestream2Component extends 
HealthCheckComponent {
     @Override
     protected Endpoint createEndpoint(String uri, String remaining, 
Map<String, Object> parameters) throws Exception {
         Timestream2Configuration configuration
-                = this.configuration != null ? this.configuration.copy() : new 
Timestream2Configuration();
+                = ObjectHelper.isNotEmpty(this.configuration) ? 
this.configuration.copy() : new Timestream2Configuration();
 
         if (!remaining.isBlank()) {
             String[] uriPath = remaining.split(":");
diff --git 
a/components/camel-aws/camel-aws2-timestream/src/main/java/org/apache/camel/component/aws2/timestream/query/Timestream2QueryEndpoint.java
 
b/components/camel-aws/camel-aws2-timestream/src/main/java/org/apache/camel/component/aws2/timestream/query/Timestream2QueryEndpoint.java
index 4e820518e4b8..cc7750c3734b 100644
--- 
a/components/camel-aws/camel-aws2-timestream/src/main/java/org/apache/camel/component/aws2/timestream/query/Timestream2QueryEndpoint.java
+++ 
b/components/camel-aws/camel-aws2-timestream/src/main/java/org/apache/camel/component/aws2/timestream/query/Timestream2QueryEndpoint.java
@@ -49,7 +49,7 @@ public class Timestream2QueryEndpoint extends 
Timestream2AbstractEndpoint implem
     @Override
     public void doStart() throws Exception {
         super.doStart();
-        awsTimestreamQueryClient = 
getConfiguration().getAwsTimestreamQueryClient() != null
+        awsTimestreamQueryClient = 
ObjectHelper.isNotEmpty(getConfiguration().getAwsTimestreamQueryClient())
                 ? getConfiguration().getAwsTimestreamQueryClient()
                 : 
Timestream2ClientFactory.getTimestreamQueryClient(getConfiguration());
     }
@@ -58,7 +58,7 @@ public class Timestream2QueryEndpoint extends 
Timestream2AbstractEndpoint implem
     public void doStop() throws Exception {
 
         if 
(ObjectHelper.isEmpty(getConfiguration().getAwsTimestreamQueryClient())) {
-            if (awsTimestreamQueryClient != null) {
+            if (ObjectHelper.isNotEmpty(awsTimestreamQueryClient)) {
                 awsTimestreamQueryClient.close();
             }
         }
diff --git 
a/components/camel-aws/camel-aws2-timestream/src/main/java/org/apache/camel/component/aws2/timestream/query/Timestream2QueryProducer.java
 
b/components/camel-aws/camel-aws2-timestream/src/main/java/org/apache/camel/component/aws2/timestream/query/Timestream2QueryProducer.java
index 0ae079fa1667..b5de72a625e1 100644
--- 
a/components/camel-aws/camel-aws2-timestream/src/main/java/org/apache/camel/component/aws2/timestream/query/Timestream2QueryProducer.java
+++ 
b/components/camel-aws/camel-aws2-timestream/src/main/java/org/apache/camel/component/aws2/timestream/query/Timestream2QueryProducer.java
@@ -75,7 +75,7 @@ public class Timestream2QueryProducer extends DefaultProducer 
{
     private Timestream2Operations determineOperation(Exchange exchange) {
         Timestream2Operations operation
                 = exchange.getIn().getHeader(Timestream2Constants.OPERATION, 
Timestream2Operations.class);
-        if (operation == null) {
+        if (ObjectHelper.isEmpty(operation)) {
             operation = getConfiguration().getOperation();
         }
         return operation;
@@ -87,7 +87,7 @@ public class Timestream2QueryProducer extends DefaultProducer 
{
 
     @Override
     public String toString() {
-        if (timestreamQueryProducerToString == null) {
+        if (ObjectHelper.isEmpty(timestreamQueryProducerToString)) {
             timestreamQueryProducerToString
                     = "TimestreamQueryProducer[" + 
URISupport.sanitizeUri(getEndpoint().getEndpointUri()) + "]";
         }
@@ -565,7 +565,7 @@ public class Timestream2QueryProducer extends 
DefaultProducer {
                 "producers",
                 WritableHealthCheckRepository.class);
 
-        if (healthCheckRepository != null) {
+        if (ObjectHelper.isNotEmpty(healthCheckRepository)) {
             String id = getEndpoint().getId();
             producerHealthCheck = new 
Timestream2QueryProducerHealthCheck(getEndpoint(), id);
             
producerHealthCheck.setEnabled(getEndpoint().getComponent().isHealthCheckProducerEnabled());
@@ -575,7 +575,7 @@ public class Timestream2QueryProducer 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;
         }
diff --git 
a/components/camel-aws/camel-aws2-timestream/src/main/java/org/apache/camel/component/aws2/timestream/write/Timestream2WriteEndpoint.java
 
b/components/camel-aws/camel-aws2-timestream/src/main/java/org/apache/camel/component/aws2/timestream/write/Timestream2WriteEndpoint.java
index 19adc2804e48..405ab64b7d0a 100644
--- 
a/components/camel-aws/camel-aws2-timestream/src/main/java/org/apache/camel/component/aws2/timestream/write/Timestream2WriteEndpoint.java
+++ 
b/components/camel-aws/camel-aws2-timestream/src/main/java/org/apache/camel/component/aws2/timestream/write/Timestream2WriteEndpoint.java
@@ -50,7 +50,7 @@ public class Timestream2WriteEndpoint extends 
Timestream2AbstractEndpoint implem
     @Override
     public void doStart() throws Exception {
         super.doStart();
-        awsTimestreamWriteClient = 
getConfiguration().getAwsTimestreamWriteClient() != null
+        awsTimestreamWriteClient = 
ObjectHelper.isNotEmpty(getConfiguration().getAwsTimestreamWriteClient())
                 ? getConfiguration().getAwsTimestreamWriteClient()
                 : 
Timestream2ClientFactory.getTimestreamWriteClient(getConfiguration());
     }
@@ -59,7 +59,7 @@ public class Timestream2WriteEndpoint extends 
Timestream2AbstractEndpoint implem
     public void doStop() throws Exception {
 
         if 
(ObjectHelper.isEmpty(getConfiguration().getAwsTimestreamWriteClient())) {
-            if (awsTimestreamWriteClient != null) {
+            if (ObjectHelper.isNotEmpty(awsTimestreamWriteClient)) {
                 awsTimestreamWriteClient.close();
             }
         }
diff --git 
a/components/camel-aws/camel-aws2-timestream/src/main/java/org/apache/camel/component/aws2/timestream/write/Timestream2WriteProducer.java
 
b/components/camel-aws/camel-aws2-timestream/src/main/java/org/apache/camel/component/aws2/timestream/write/Timestream2WriteProducer.java
index 4f0bb640917f..6ebb8f1e8631 100644
--- 
a/components/camel-aws/camel-aws2-timestream/src/main/java/org/apache/camel/component/aws2/timestream/write/Timestream2WriteProducer.java
+++ 
b/components/camel-aws/camel-aws2-timestream/src/main/java/org/apache/camel/component/aws2/timestream/write/Timestream2WriteProducer.java
@@ -81,7 +81,7 @@ public class Timestream2WriteProducer extends DefaultProducer 
{
     private Timestream2Operations determineOperation(Exchange exchange) throws 
InvalidPayloadException {
         Timestream2Operations operation
                 = exchange.getIn().getHeader(Timestream2Constants.OPERATION, 
Timestream2Operations.class);
-        if (operation == null) {
+        if (ObjectHelper.isEmpty(operation)) {
             operation = getConfiguration().getOperation();
         }
         return operation;
@@ -93,7 +93,7 @@ public class Timestream2WriteProducer extends DefaultProducer 
{
 
     @Override
     public String toString() {
-        if (timestreamWriteProducerToString == null) {
+        if (ObjectHelper.isEmpty(timestreamWriteProducerToString)) {
             timestreamWriteProducerToString
                     = "TimestreamWriteProducer[" + 
URISupport.sanitizeUri(getEndpoint().getEndpointUri()) + "]";
         }
@@ -746,7 +746,7 @@ public class Timestream2WriteProducer extends 
DefaultProducer {
                 "producers",
                 WritableHealthCheckRepository.class);
 
-        if (healthCheckRepository != null) {
+        if (ObjectHelper.isNotEmpty(healthCheckRepository)) {
             String id = getEndpoint().getId();
             producerHealthCheck = new 
Timestream2WriteProducerHealthCheck(getEndpoint(), id);
             
producerHealthCheck.setEnabled(getEndpoint().getComponent().isHealthCheckProducerEnabled());
@@ -756,7 +756,7 @@ public class Timestream2WriteProducer 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