Fix lgtm.com alert: potential NPE due to non-short circuit logic

The logical-AND operator '&&' evaluates its operands in order, which is
what is required here. The bitwise-AND operator '&' always evaluates all
operands, which will in some cases result in a NPE in the second
operand.

Details:
https://lgtm.com/projects/g/keycloak/keycloak/snapshot/dist-7900299-1490802114895/files/services/src/main/java/org/keycloak/services/resources/admin/RealmAdminResource.java#V543
This commit is contained in:
Bas van Schaik 2017-04-28 14:51:51 +01:00
parent eb93eef874
commit 2df1175315

View file

@ -541,7 +541,7 @@ public class RealmAdminResource {
query.client(client);
}
if (types != null & !types.isEmpty()) {
if (types != null && !types.isEmpty()) {
EventType[] t = new EventType[types.size()];
for (int i = 0; i < t.length; i++) {
t[i] = EventType.valueOf(types.get(i));