Commit c483c5c
authored
Fix strcmp treating null and empty strings as equal (#1069)
* 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: 207440
* A json with a string field with value "null" was being serialized as ""1 parent cca0a3f commit c483c5c
File tree
2 files changed
+9
-4
lines changed- common/src/main/java/com/genexus
- java/src/test/java/com/genexus
2 files changed
+9
-4
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 | | |
| |||
2804 | 2809 | | |
2805 | 2810 | | |
2806 | 2811 | | |
2807 | | - | |
| 2812 | + | |
2808 | 2813 | | |
2809 | 2814 | | |
2810 | 2815 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
295 | 295 | | |
296 | 296 | | |
297 | 297 | | |
298 | | - | |
| 298 | + | |
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
| |||
0 commit comments