rohithvegesna opened a new pull request, #16348:
URL: https://github.com/apache/dubbo/pull/16348

   ## What is the purpose of the change
   
   Fixes #16347.
   
   `StringUtils.toBoolean("off")` returned `Boolean.TRUE`. The method's Javadoc 
lists `'on'/'off'`
   as a boolean pair and every other falsy token is parsed correctly, so 
`"off"` returning true is a
   copy-paste error from the adjacent `"yes"` branch:
   
   ```
   on=true   off=true(!)   yes=true   no=false   true=true   false=false   
1=true   0=false
   ```
   
   `toBoolean` backs Triple REST argument binding (`GeneralTypeConverter`) and 
REST/OpenAPI config
   parsing (`ConfigFactory`, `Helper`), where a value of `"off"` was 
interpreted as `true`.
   
   ## Brief changelog
   
   - Return `Boolean.FALSE` for `"off"` in `StringUtils.toBoolean`.
   - Add `StringUtilsTest.testToBoolean` covering the full set of supported 
tokens (the method had no test).
   
   ## Verifying this change
   
   - `mvn -pl dubbo-common test -Dtest=StringUtilsTest`
   
   ## Checklist
   - [x] Make sure there is a [GitHub 
issue](https://github.com/apache/dubbo/issues/16347) field for the change.
   - [x] Write a pull request description that is detailed enough to understand 
what the pull request does, how, and why.
   - [x] Write necessary unit-test to verify your logic correction.
   - [x] Make sure GitHub actions can pass.
   


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to