diff --git a/java/ql/lib/semmle/code/java/ControlFlowGraph.qll b/java/ql/lib/semmle/code/java/ControlFlowGraph.qll index 9ef33fe83c2..5ffb37b585f 100644 --- a/java/ql/lib/semmle/code/java/ControlFlowGraph.qll +++ b/java/ql/lib/semmle/code/java/ControlFlowGraph.qll @@ -347,7 +347,17 @@ private module ControlFlowGraphImpl { ) } - private ThrowableType assertionError() { result.hasQualifiedName("java.lang", "AssertionError") } + private ThrowableType actualAssertionError() { + result.hasQualifiedName("java.lang", "AssertionError") + } + + private ThrowableType assertionError() { + result = actualAssertionError() + or + // In case `AssertionError` is not extracted, we use `Error` as a fallback. + not exists(actualAssertionError()) and + result.hasQualifiedName("java.lang", "Error") + } /** * Gets an exception type that may be thrown during execution of the