mirror of
https://github.com/github/codeql.git
synced 2026-04-24 16:25:15 +02:00
Java: Add java/javautilconcurrentscheduledthreadpoolexecutor query for zero thread pool size
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
| Test.java:7:42:7:75 | new ScheduledThreadPoolExecutor(...) | ScheduledThreadPoolExecutor.corePoolSize is set to have 0 threads. |
|
||||
| Test.java:8:9:8:28 | setCorePoolSize(...) | ScheduledThreadPoolExecutor.corePoolSize is set to have 0 threads. |
|
||||
| Test.java:9:9:9:28 | setCorePoolSize(...) | ScheduledThreadPoolExecutor.corePoolSize is set to have 0 threads. |
|
||||
@@ -0,0 +1,2 @@
|
||||
query: Likely Bugs/Concurrency/ScheduledThreadPoolExecutorZeroThread.ql
|
||||
postprocess: utils/test/InlineExpectationsTestQuery.ql
|
||||
@@ -0,0 +1,11 @@
|
||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||
|
||||
public class Test {
|
||||
void f() {
|
||||
int i = 0;
|
||||
ScheduledThreadPoolExecutor s = new ScheduledThreadPoolExecutor(1); // Compliant
|
||||
ScheduledThreadPoolExecutor s1 = new ScheduledThreadPoolExecutor(0); // $ Alert
|
||||
s.setCorePoolSize(0); // $ Alert
|
||||
s.setCorePoolSize(i); // $ Alert
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user