[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:
赵延 2020-11-04 16:41:07 +08:00 committed by GitHub
parent 1282445cf6
commit 053b7819d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -79,7 +79,7 @@ public class DefaultSharePublisher extends DefaultPublisher {
try {
Set<Subscriber> sets = subMappings.get(subSlowEventType);
if (sets != null && sets.contains(subscriber)) {
if (sets != null) {
sets.remove(subscriber);
}
} finally {

View File

@ -131,7 +131,7 @@ public class MapUtils {
*
* @param target target Map data.
* @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 param2 function's parameter value1.
* @return
@ -140,10 +140,11 @@ public class MapUtils {
public static Object computeIfAbsent(Map target, Object key, BiFunction mappingFunction, Object param1,
Object param2) {
Objects.requireNonNull(target, "target");
Objects.requireNonNull(key, "key");
Objects.requireNonNull(key, "mappingFunction");
Objects.requireNonNull(key, "param1");
Objects.requireNonNull(key, "param2");
Objects.requireNonNull(mappingFunction, "mappingFunction");
Objects.requireNonNull(param1, "param1");
Objects.requireNonNull(param2, "param2");
Object val = target.get(key);
if (val == null) {