-
Bug
-
Resolution: Fixed
-
P2
-
8
-
b01
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8031288 | 8u5 | Mike Duigou | P2 | Resolved | Fixed | b03 |
JDK-8031011 | 8 | Mike Duigou | P2 | Closed | Fixed | b122 |
JDK-8030348 | na | Mike Duigou | P2 | Resolved | Fixed | b01 |
Map.merge<http://download.java.net/jdk8/docs/api/java/util/Map.html#merge-K-V-java.util.function.BiFunction->states
that its default implementation is equivalent to:
V oldValue = map.get(key);
V newValue = (oldValue == null) ? value :
remappingFunction.apply(oldValue, value);
if (newValue == null)
map.remove(key);
else if (oldValue == null)
map.remove(key);
else
map.put(key, newValue);
This is not correct as for non-existing or null-value, the non-null newValuw should be added to the map.
that its default implementation is equivalent to:
V oldValue = map.get(key);
V newValue = (oldValue == null) ? value :
remappingFunction.apply(oldValue, value);
if (newValue == null)
map.remove(key);
else if (oldValue == null)
map.remove(key);
else
map.put(key, newValue);
This is not correct as for non-existing or null-value, the non-null newValuw should be added to the map.
- backported by
-
JDK-8030348 Map.merge must refuse null values
-
- Resolved
-
-
JDK-8031288 Map.merge must refuse null values
-
- Resolved
-
-
JDK-8031011 Map.merge must refuse null values
-
- Closed
-
- relates to
-
JDK-8292955 Collections.checkedMap Map.merge does not properly check key and value
-
- Closed
-