[ISSUE-#4125] Fix param check in com.alibaba.nacos.common.utils.MapUtils#computeIfAbsent (#4126)
* fix param check mismatch * add map check
This commit is contained in:
parent
1282445cf6
commit
053b7819d6
@ -79,7 +79,7 @@ public class DefaultSharePublisher extends DefaultPublisher {
|
|||||||
try {
|
try {
|
||||||
Set<Subscriber> sets = subMappings.get(subSlowEventType);
|
Set<Subscriber> sets = subMappings.get(subSlowEventType);
|
||||||
|
|
||||||
if (sets != null && sets.contains(subscriber)) {
|
if (sets != null) {
|
||||||
sets.remove(subscriber);
|
sets.remove(subscriber);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -131,7 +131,7 @@ public class MapUtils {
|
|||||||
*
|
*
|
||||||
* @param target target Map data.
|
* @param target target Map data.
|
||||||
* @param key map key.
|
* @param key map key.
|
||||||
* @param mappingFunction funtion which is need to be executed.
|
* @param mappingFunction function which is need to be executed.
|
||||||
* @param param1 function's parameter value1.
|
* @param param1 function's parameter value1.
|
||||||
* @param param2 function's parameter value1.
|
* @param param2 function's parameter value1.
|
||||||
* @return
|
* @return
|
||||||
@ -140,10 +140,11 @@ public class MapUtils {
|
|||||||
public static Object computeIfAbsent(Map target, Object key, BiFunction mappingFunction, Object param1,
|
public static Object computeIfAbsent(Map target, Object key, BiFunction mappingFunction, Object param1,
|
||||||
Object param2) {
|
Object param2) {
|
||||||
|
|
||||||
|
Objects.requireNonNull(target, "target");
|
||||||
Objects.requireNonNull(key, "key");
|
Objects.requireNonNull(key, "key");
|
||||||
Objects.requireNonNull(key, "mappingFunction");
|
Objects.requireNonNull(mappingFunction, "mappingFunction");
|
||||||
Objects.requireNonNull(key, "param1");
|
Objects.requireNonNull(param1, "param1");
|
||||||
Objects.requireNonNull(key, "param2");
|
Objects.requireNonNull(param2, "param2");
|
||||||
|
|
||||||
Object val = target.get(key);
|
Object val = target.get(key);
|
||||||
if (val == null) {
|
if (val == null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user