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

This commit is contained in:
Looly 2024-05-17 17:02:59 +08:00
parent 6689c08ecf
commit 7999baec85
2 changed files with 9 additions and 1 deletions

View File

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

View File

@ -107,4 +107,12 @@ public class BooleanUtilTest {
Assertions.assertNull(BooleanUtil.toBooleanObject(null));
Assertions.assertNull(BooleanUtil.toBooleanObject("不识别"));
}
@Test
public void issue3587Test() {
final Boolean boolean1 = true;
final Boolean boolean2 = null;
final Boolean result = BooleanUtil.andOfWrap(boolean1, boolean2);
Assertions.assertFalse(result);
}
}