From c091fc585bc18b47d980b515c14039813809dcaa Mon Sep 17 00:00:00 2001 From: Anders Schack-Mulligen Date: Thu, 26 Jun 2025 11:03:59 +0200 Subject: [PATCH] Java: Account for AssertionError possibly not being extracted. --- java/ql/lib/semmle/code/java/ControlFlowGraph.qll | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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