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

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


The following commit(s) were added to refs/heads/main by this push:
     new 78faee69d05 CAMEL-19398: simplify the customParseBoolean (#11321)
78faee69d05 is described below

commit 78faee69d0537199f662e76a55d67d756a8cfce3
Author: Otavio Rodolfo Piske <[email protected]>
AuthorDate: Wed Sep 20 16:12:36 2023 +0200

    CAMEL-19398: simplify the customParseBoolean (#11321)
---
 .../impl/converter/CoreTypeConverterRegistry.java  | 27 ++++------------------
 1 file changed, 4 insertions(+), 23 deletions(-)

diff --git 
a/core/camel-base/src/main/java/org/apache/camel/impl/converter/CoreTypeConverterRegistry.java
 
b/core/camel-base/src/main/java/org/apache/camel/impl/converter/CoreTypeConverterRegistry.java
index 20caa790a56..f520c3712ae 100644
--- 
a/core/camel-base/src/main/java/org/apache/camel/impl/converter/CoreTypeConverterRegistry.java
+++ 
b/core/camel-base/src/main/java/org/apache/camel/impl/converter/CoreTypeConverterRegistry.java
@@ -175,32 +175,13 @@ public abstract class CoreTypeConverterRegistry extends 
ServiceSupport implement
         return (T) doConvertToAndStat(type, exchange, value, false);
     }
 
-    // must be 4 or 5 in length
     private static Boolean customParseBoolean(String str) {
-        int len = str.length();
-        // fast check the value as-is in lower case which is most common
-        if (len == 4) {
-            if ("true".equals(str)) {
-                return Boolean.TRUE;
-            }
-
-            if ("TRUE".equals(str.toUpperCase())) {
-                return Boolean.TRUE;
-            }
-
-            return null;
+        if ("true".equalsIgnoreCase(str)) {
+            return Boolean.TRUE;
         }
 
-        if (len == 5) {
-            if ("false".equals(str)) {
-                return Boolean.FALSE;
-            }
-
-            if ("FALSE".equals(str.toUpperCase())) {
-                return Boolean.FALSE;
-            }
-
-            return null;
+        if ("false".equalsIgnoreCase(str)) {
+            return Boolean.FALSE;
         }
 
         return null;

Reply via email to