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

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

commit 9d3577298fe33eac1eb269bea5b5bebd4077d0c4
Author: Guillaume Nodet <gno...@gmail.com>
AuthorDate: Tue May 14 14:45:16 2024 +0200

    Fix wrong isNotEmpty calls
---
 .../java/org/apache/camel/support/component/ApiMethodHelper.java  | 8 ++------
 .../src/main/java/org/apache/camel/support/jndi/JndiContext.java  | 4 ++--
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git 
a/core/camel-support/src/main/java/org/apache/camel/support/component/ApiMethodHelper.java
 
b/core/camel-support/src/main/java/org/apache/camel/support/component/ApiMethodHelper.java
index 05453887ccf..e11889f374b 100644
--- 
a/core/camel-support/src/main/java/org/apache/camel/support/component/ApiMethodHelper.java
+++ 
b/core/camel-support/src/main/java/org/apache/camel/support/component/ApiMethodHelper.java
@@ -104,18 +104,14 @@ public final class ApiMethodHelper<T extends Enum<T> & 
ApiMethod> {
                     // add method name alias
                     String alias = matcher.replaceAll(aliasEntry.getValue());
                     // convert first character to lowercase
-                    ObjectHelper.isNotEmpty(alias);
+                    ObjectHelper.notNullOrEmpty(alias, "alias");
                     final char firstChar = alias.charAt(0);
                     if (!Character.isLowerCase(firstChar)) {
                         final StringBuilder builder = new StringBuilder();
                         
builder.append(Character.toLowerCase(firstChar)).append(alias, 1, 
alias.length());
                         alias = builder.toString();
                     }
-                    Set<String> names = tmpAliasesMap.get(alias);
-                    if (names == null) {
-                        names = new HashSet<>();
-                        tmpAliasesMap.put(alias, names);
-                    }
+                    Set<String> names = tmpAliasesMap.computeIfAbsent(alias, k 
-> new HashSet<>());
                     names.add(name);
                 }
             }
diff --git 
a/core/camel-support/src/main/java/org/apache/camel/support/jndi/JndiContext.java
 
b/core/camel-support/src/main/java/org/apache/camel/support/jndi/JndiContext.java
index 36f28429ea4..f09c4ce3a6c 100644
--- 
a/core/camel-support/src/main/java/org/apache/camel/support/jndi/JndiContext.java
+++ 
b/core/camel-support/src/main/java/org/apache/camel/support/jndi/JndiContext.java
@@ -109,7 +109,7 @@ public class JndiContext implements Context, Serializable {
      * (the names are suitably extended by the segment originally lopped off).
      */
     protected Map<String, Object> internalBind(String name, Object value) 
throws NamingException {
-        org.apache.camel.util.ObjectHelper.isNotEmpty(name);
+        org.apache.camel.util.ObjectHelper.notNullOrEmpty(name, "name");
         org.apache.camel.util.ObjectHelper.notNull(frozen, "frozen");
 
         Map<String, Object> newBindings = new HashMap<>();
@@ -122,7 +122,7 @@ public class JndiContext implements Context, Serializable {
             newBindings.put(name, value);
         } else {
             String segment = name.substring(0, pos);
-            org.apache.camel.util.ObjectHelper.isNotEmpty(segment);
+            org.apache.camel.util.ObjectHelper.notNullOrEmpty(segment, 
"segment");
             Object o = treeBindings.get(segment);
             if (o == null) {
                 o = newContext();

Reply via email to