-
Couldn't load subscription status.
- Fork 38.8k
Closed
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: bugA general bugA general bug
Milestone
Description
Alexey Pomelov opened SPR-13981 and commented
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
Affects: 4.2.4
Issue Links:
- LinkedCaseInsensitiveMap does not properly support Java 8's merge() and compute() methods [SPR-15026] #19593 LinkedCaseInsensitiveMap does not properly support Java 8's merge() and compute() methods
- LinkedCaseInsensitiveMap doesn't override HashMap.clone() [SPR-14509] #19078 LinkedCaseInsensitiveMap doesn't override HashMap.clone()
- Inconsistent handling of null values through Java 8 accessors in ConcurrentReferenceHashMap [SPR-16584] #21126 Inconsistent handling of null values through Java 8 accessors in ConcurrentReferenceHashMap
- LinkedCaseInsensitiveMap should explicitly implement putIfAbsent and computeIfAbsent [SPR-16926] #21465 LinkedCaseInsensitiveMap should explicitly implement putIfAbsent and computeIfAbsent
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: bugA general bugA general bug