Closed wseibel closed 7 months ago
Very apt catch, @wseibel .
// if-clause checks v.startsWith(c) if (caseInsensitive) {return v.toLowerCase(..).startsWith(c.toLowerCase(..)); }else {// else-clause checks c.startsWith(v) (as opposite of the if-clause check!!) return c.startsWith(v); // <-- this is correct }
It is obvious to fix.
I think v and c both need to be interchanged in if clause. What do you think, @wseibel ?
@rishiraj88 thanks for the quick reply. You're absolutely right.
A big thanks to both of you, great report, I'll get a fix out, and add a test so we catch it if it happens again.
Handled in #240
Added in 9.2.1, should be synced to most mirrors by now. This https://repo1.maven.org/maven2/io/getunleash/unleash-client-java/9.2.1/ is at least present on central
Describe the bug
When using the STR_STARTS_WITH operator as a constraint on any context field with case-sensitive de-activated, the constraint is always evaluates to false.
Steps to reproduce the bug
Create an activation strategy for an enabled feature-toggle and update it with the following definition
Now evaluate the feature toggle you updated the strategy for with any user-id that starts with "0". The result is "disabled".
Expected behavior
The evaluation result should return the variation with the name "a".
Logs, error output, etc.
No response
Screenshots
No response
Additional context
When looking into the code the error is easy to spot
The comparison is the wrong way around as can be seen in the else-branch or any other method in this class, where it's done correctly.
Unleash version
No response
Subscription type
None
Hosting type
None
SDK information (language and version)
unleash-client-java:9.2.0