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

    Camel-AWS components: Use ObjectHelper for null checks - Transcribe
    
    Signed-off-by: Andrea Cosentino <[email protected]>
---
 .../aws2/transcribe/Transcribe2Component.java          | 18 +++++++++---------
 .../component/aws2/transcribe/Transcribe2Endpoint.java |  4 ++--
 .../component/aws2/transcribe/Transcribe2Producer.java |  2 +-
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git 
a/components/camel-aws/camel-aws2-transcribe/src/main/java/org/apache/camel/component/aws2/transcribe/Transcribe2Component.java
 
b/components/camel-aws/camel-aws2-transcribe/src/main/java/org/apache/camel/component/aws2/transcribe/Transcribe2Component.java
index 2eebc5ddc8b8..2589a12d6f6e 100644
--- 
a/components/camel-aws/camel-aws2-transcribe/src/main/java/org/apache/camel/component/aws2/transcribe/Transcribe2Component.java
+++ 
b/components/camel-aws/camel-aws2-transcribe/src/main/java/org/apache/camel/component/aws2/transcribe/Transcribe2Component.java
@@ -52,7 +52,7 @@ public class Transcribe2Component extends DefaultComponent {
         }
 
         Transcribe2Configuration configuration
-                = this.configuration != null ? this.configuration.clone() : 
new Transcribe2Configuration();
+                = ObjectHelper.isNotEmpty(this.configuration) ? 
this.configuration.clone() : new Transcribe2Configuration();
         configuration.setLabel(remaining);
         Transcribe2Endpoint endpoint = new Transcribe2Endpoint(uri, this, 
configuration);
         setProperties(endpoint, parameters);
@@ -65,8 +65,8 @@ public class Transcribe2Component extends DefaultComponent {
         if (ObjectHelper.isEmpty(endpoint.getConfiguration().getRegion())) {
             setRegionOnEndpoint(endpoint);
         }
-        if (endpoint.getConfiguration().getTranscribeClient() == null
-                && (endpoint.getConfiguration().getAccessKey() == null || 
endpoint.getConfiguration().getSecretKey() == null)) {
+        if 
(ObjectHelper.isEmpty(endpoint.getConfiguration().getTranscribeClient())
+                && 
(ObjectHelper.isEmpty(endpoint.getConfiguration().getAccessKey()) || 
ObjectHelper.isEmpty(endpoint.getConfiguration().getSecretKey()))) {
             throw new IllegalArgumentException("Amazon transcribe client or 
accessKey and secretKey must be specified");
         }
 
@@ -83,30 +83,30 @@ public class Transcribe2Component extends DefaultComponent {
 
     private void setAccessKeyOnEndpoint(Transcribe2Endpoint endpoint) {
         String accessKey = System.getProperty("aws.accessKeyId");
-        if (accessKey == null) {
+        if (ObjectHelper.isEmpty(accessKey)) {
             accessKey = System.getenv("AWS_ACCESS_KEY_ID");
         }
-        if (accessKey != null) {
+        if (ObjectHelper.isNotEmpty(accessKey)) {
             endpoint.getConfiguration().setAccessKey(accessKey);
         }
     }
 
     private void setSecretKeyOnEndpoint(Transcribe2Endpoint endpoint) {
         String secretKey = System.getProperty("aws.secretKey");
-        if (secretKey == null) {
+        if (ObjectHelper.isEmpty(secretKey)) {
             secretKey = System.getenv("AWS_SECRET_ACCESS_KEY");
         }
-        if (secretKey != null) {
+        if (ObjectHelper.isNotEmpty(secretKey)) {
             endpoint.getConfiguration().setSecretKey(secretKey);
         }
     }
 
     private void setRegionOnEndpoint(Transcribe2Endpoint endpoint) {
         String region = System.getProperty("aws.region");
-        if (region == null) {
+        if (ObjectHelper.isEmpty(region)) {
             region = System.getenv("AWS_REGION");
         }
-        if (region != null) {
+        if (ObjectHelper.isNotEmpty(region)) {
             endpoint.getConfiguration().setRegion(region);
         }
     }
diff --git 
a/components/camel-aws/camel-aws2-transcribe/src/main/java/org/apache/camel/component/aws2/transcribe/Transcribe2Endpoint.java
 
b/components/camel-aws/camel-aws2-transcribe/src/main/java/org/apache/camel/component/aws2/transcribe/Transcribe2Endpoint.java
index 31406f63af5e..cc68f0017c84 100644
--- 
a/components/camel-aws/camel-aws2-transcribe/src/main/java/org/apache/camel/component/aws2/transcribe/Transcribe2Endpoint.java
+++ 
b/components/camel-aws/camel-aws2-transcribe/src/main/java/org/apache/camel/component/aws2/transcribe/Transcribe2Endpoint.java
@@ -58,14 +58,14 @@ public class Transcribe2Endpoint extends DefaultEndpoint {
     @Override
     public void doStart() throws Exception {
         super.doStart();
-        transcribeClient = configuration.getTranscribeClient() != null
+        transcribeClient = 
ObjectHelper.isNotEmpty(configuration.getTranscribeClient())
                 ? configuration.getTranscribeClient() : 
Transcribe2ClientFactory.getTranscribeClient(configuration);
     }
 
     @Override
     public void doStop() throws Exception {
         if (ObjectHelper.isEmpty(configuration.getTranscribeClient())) {
-            if (transcribeClient != null) {
+            if (ObjectHelper.isNotEmpty(transcribeClient)) {
                 transcribeClient.close();
             }
         }
diff --git 
a/components/camel-aws/camel-aws2-transcribe/src/main/java/org/apache/camel/component/aws2/transcribe/Transcribe2Producer.java
 
b/components/camel-aws/camel-aws2-transcribe/src/main/java/org/apache/camel/component/aws2/transcribe/Transcribe2Producer.java
index ef0e8ce6229f..d0079629043b 100644
--- 
a/components/camel-aws/camel-aws2-transcribe/src/main/java/org/apache/camel/component/aws2/transcribe/Transcribe2Producer.java
+++ 
b/components/camel-aws/camel-aws2-transcribe/src/main/java/org/apache/camel/component/aws2/transcribe/Transcribe2Producer.java
@@ -542,7 +542,7 @@ public class Transcribe2Producer extends DefaultProducer {
 
     @Override
     public String toString() {
-        if (transcribeProducerToString == null) {
+        if (ObjectHelper.isEmpty(transcribeProducerToString)) {
             transcribeProducerToString = "Transcribe2Producer[" + 
URISupport.sanitizeUri(getEndpoint().getEndpointUri()) + "]";
         }
         return transcribeProducerToString;

Reply via email to