修复BooleanUtil.andOfWrap针对null错误问题

This commit is contained in:
Looly 2024-05-17 17:02:53 +08:00
parent fe01021c72
commit 9e1beae3eb
4 changed files with 10 additions and 2 deletions
CHANGELOG.md
hutool-core/src
main/java/cn/hutool/core/util
test/java/cn/hutool/core/util
hutool-json/src/test/java/cn/hutool/json

View File

@ -42,6 +42,7 @@
* 【core 】 修复NumberWordFormatter.format小数问题issue#3579@Github
* 【db 】 修复JndiDSFactory空指针问题
* 【core 】 修复BiMap.put错误的返回值pr#1218@Gitee
* 【core 】 修复BooleanUtil.andOfWrap针对null错误问题issue#3587@Github
-------------------------------------------------------------------------------------------------------------
# 5.8.27(2024-03-29)

View File

@ -380,7 +380,7 @@ public class BooleanUtil {
}
for (final Boolean b : array) {
if(isFalse(b)){
if(!isTrue(b)){
return false;
}
}

View File

@ -72,4 +72,12 @@ public class BooleanUtilTest {
Assert.assertEquals("on", BooleanUtil.toStringOnOff(true));
Assert.assertEquals("off", BooleanUtil.toStringOnOff(false));
}
@Test
public void issue3587Test() {
Boolean boolean1 = true;
Boolean boolean2 = null;
Boolean result = BooleanUtil.andOfWrap(boolean1, boolean2);
Assert.assertFalse(result);
}
}

View File

@ -1,6 +1,5 @@
package cn.hutool.json;
import cn.hutool.core.lang.Console;
import lombok.Data;
import org.junit.Assert;
import org.junit.Test;