The code has a return statement inside a finally block, which will cause any thrown exception in the try block to be discarded.
Time of Introduction
Implementation
Common Consequences
Scope
Effect
Other
Technical Impact: Alter execution
logic
Demonstrative Examples
Example 1
In the following code excerpt, the IllegalArgumentException will
never be delivered to the caller. The finally block will cause the exception
to be discarded.
(Bad Code)
Example
Language: Java
try {
...
throw IllegalArgumentException();
}
finally {
return r;
}
Potential Mitigations
Do not use a return statement inside the finally block. The finally
block should have "cleanup" code.