Skip to content

Commit bed1b74

Browse files
authored
Merge pull request #1576 from rneatherway/java/is-not-empty-null-guards-1.21
Java: Add `isNotEmpty` to NullGuards
2 parents 02bded3 + 5c19e00 commit bed1b74

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

java/ql/src/semmle/code/java/dataflow/NullGuards.qll

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,14 @@ predicate nullCheckMethod(Method m, boolean branch, boolean isnull) {
120120
m.hasName("isBlank") and
121121
branch = false and
122122
isnull = false
123+
or
124+
(
125+
m.getDeclaringType().hasQualifiedName("org.apache.commons.collections4", "CollectionUtils") or
126+
m.getDeclaringType().hasQualifiedName("org.apache.commons.collections", "CollectionUtils")
127+
) and
128+
m.hasName("isNotEmpty") and
129+
branch = true and
130+
isnull = false
123131
}
124132

125133
/**

0 commit comments

Comments
 (0)