Hi,
there is a false-positive of squid:S3626:
A try-catch-finally with a return
statement in the catch block and additional code after the finally-block.
The return
is not redundant, because removing it leads to execution of the additional code, which is not supposed to be executed if an exception is caught.
void foo() {
try {
System.out.println("In try block.");
doSomethingThatMightThrow();
} catch (RuntimeException ex) {
System.out.println("In catch block.");
return; // squid:S3626 false positive here
} finally {
System.out.println("In finally block.");
}
System.out.println("This should only be printed if no exception occurred.");
}
using SonarLint 4.3.0.3495