Commit 8d69a59
committed
Fix strcmp treating null and empty strings as equal
Previously, strcmp could return equality when comparing a null value
with an empty string.
This happened because rtrim(null) returned an empty string, causing
null and "" to be treated as equivalent during comparison.
This change preserves the semantic difference between null and empty
strings by handling null values explicitly and delegating comparison
to Comparator.nullsFirst after trimming.
Behavior:
- null is considered less than any non-null String
- empty strings are not equal to null
- trailing whitespace is ignored during comparison
Issue: 2074401 parent 5eb8ee1 commit 8d69a59
1 file changed
+7
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
853 | 854 | | |
854 | 855 | | |
855 | 856 | | |
856 | | - | |
857 | | - | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
858 | 863 | | |
859 | 864 | | |
860 | 865 | | |
| |||
0 commit comments