Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ predicate overlappingExceptions(RefType e1, RefType e2) {

from TryStmt try, int first, int second, RefType masking, RefType masked, string multiCatchMsg
where
try.getFile().isJavaSourceFile() and
masking = caughtType(try, first) and
masking.getAStrictAncestor() = masked and
masked = caughtType(try, second) and
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Likely Bugs/Statements/PartiallyMaskedCatch.ql
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
fun fn0() { throw java.io.IOException() }

fun fn1() {
try {
throw java.io.IOException()
} catch (e: java.io.FileNotFoundException) {
println(e)
} catch (e: java.io.IOException) {
println(e)
}
}

fun fn2() {
try {
fn0()
} catch (e: java.io.FileNotFoundException) {
println(e)
} catch (e: java.io.IOException) {
println(e)
}
}

fun fn3() {
try {
throw java.io.FileNotFoundException()
} catch (e: java.io.FileNotFoundException) {
println(e)
} catch (e: java.io.IOException) { // TODO: False negative
println(e)
}
}