github / github/codeql

Java: Callable.getAnException() reports thrown exceptions

未關閉
#5,464 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
acknowledged Java not security
主要語言
CodeQL
星號
10.1k
分支
2.1k
平均合併
2 天 15 小時
30 天內合併 PR
141

描述

[`Callable.getAnException()`](https://codeql.github.com/codeql-standard-libraries/java/semmle/code/java/Member.qll/predicate.Member$Callable$getAnException.0.html) is documented as:
> Gets an exception that occurs in the `throws` clause of this callable.

Note how it says `throws` clause, not `throw` statement. Yet it appears to be reporting exceptions which do not appear in the `throws` clause, but appear inside `throw` statements:
```ql
import java

from Method m, Exception e
where
m.fromSource()
and e = m.getAnException()
and not e.fromSource()
select m, e.toString()
```
[Query Console link](https://lgtm.com/query/5757069100542810787/)
The found `Exception` elements also seem to cause issues for the Query Console, see #5465.

(This also affects `Callable.getAThrownExceptionType()` which delegates to `getAnException()`.)

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。