修复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

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);
}
}