davsclaus commented on code in PR #11321:
URL: https://github.com/apache/camel/pull/11321#discussion_r1331295117


##########
core/camel-core/src/test/java/org/apache/camel/util/CamelContextHelperTest.java:
##########
@@ -45,7 +45,7 @@ public void testParsing() {
         eq(() -> CamelContextHelper.parseBoolean(context, "false"), false);
         eq(() -> CamelContextHelper.parseBoolean(context, "TrUe"), true);
         eq(() -> CamelContextHelper.parseBoolean(context, "FaLsE"), false);
-        fl(() -> CamelContextHelper.parseBoolean(context, "5"), 
IllegalArgumentException.class);
+        eq(() -> CamelContextHelper.parseBoolean(context, "5"), false);

Review Comment:
   If you want to use Boolean.parseBoolean, then you can do that first, and 
only check for invalid input if the result was false.
   
   var a = Boolean.parseBoolean(s)
   if a == false {
      .. // okay the input may be invalid, so check for that
   }



##########
core/camel-core/src/test/java/org/apache/camel/util/CamelContextHelperTest.java:
##########
@@ -45,7 +45,7 @@ public void testParsing() {
         eq(() -> CamelContextHelper.parseBoolean(context, "false"), false);
         eq(() -> CamelContextHelper.parseBoolean(context, "TrUe"), true);
         eq(() -> CamelContextHelper.parseBoolean(context, "FaLsE"), false);
-        fl(() -> CamelContextHelper.parseBoolean(context, "5"), 
IllegalArgumentException.class);
+        eq(() -> CamelContextHelper.parseBoolean(context, "5"), false);

Review Comment:
   Yeah this is bad - it should not be false as the input is invalid. We 
basically need to just check for true|false as only valid input - as the old 
code.
   
   A lot of Camel use is configuration, so if you have a mistake there, then 
concerting to false would make it appear as working but something was not 
configured correctly.
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to