You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The default getOrDefault method implemented in the java.util.Map interface uses only get and containsKey methods. Within the LinkedCaseInsensitiveMap class these methods work with special form of keys. But getOrDefault method is overriden also in HashMap and LinkedHashMap and it calculates hashes for keys itself.
As a result can get this behavior.
Assuming select a single row via jdbc template with the column IS_SINGLE=Y
Here are results of some method calls to the resulting map:
map.containsKey("is_single") // true
map.containsKey("IS_SINGLE") // true
map.get("is_single") // Y
map.get("IS_SINGLE") // Y
map.getOrDefault("is_single", "N") // N !!!
map.getOrDefault("IS_SINGLE", "N") // Y
Thanks for the report and the pull request, guys! Fixed as part of a slightly wider revision of that class, also handling stored null values correctly.
Alexey Pomelov opened SPR-13981 and commented
The default
getOrDefault
method implemented in thejava.util.Map
interface uses onlyget
andcontainsKey
methods. Within theLinkedCaseInsensitiveMap
class these methods work with special form of keys. ButgetOrDefault
method is overriden also inHashMap
andLinkedHashMap
and it calculates hashes for keys itself.As a result can get this behavior.
Assuming select a single row via jdbc template with the column
IS_SINGLE=Y
Here are results of some method calls to the resulting map:
Affects: 4.2.4
Issue Links:
The text was updated successfully, but these errors were encountered: