[fix] Fix use of computeIfPresent with HashMap with possible null values
Signed-off-by: Emmanuel Bigeon <emmanuel@bigeon.fr>
This commit is contained in:
parent
ea01d346d3
commit
625cacb198
@ -207,7 +207,11 @@ public final class CommandParameters {
|
||||
* @param string the key
|
||||
* @param value the value */
|
||||
public void set(final String string, final String value) {
|
||||
stringArguments.computeIfPresent(string,
|
||||
(final String k, final String v) -> value);
|
||||
// DO NOT USE computeIfPresent. This is a HashMap, not a ConcurrentHashMap and
|
||||
// keys can be associated to null, but computeIfPresent will consider them as
|
||||
// absent!
|
||||
if (stringArguments.containsKey(string)) {
|
||||
stringArguments.put(string, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user