Rule Definition
Finally blocks must be used to execute the code that is needed after either the try and/or the catch block have been executed. It is usually the place to code the release of resources used in the try block. As such, an empty finally block is most probably the sign of potential "resource leaks" that will jeopardize the application's stability.
Remediation
Add code to the finally block, especially the release of resources used in the try block, if any.
Violation Code Sample
try { ... }
catch ( MyException e)
{ ,,, }
finally
{
// DO NOTHING <= VIOLATION
}
Fixed Code Sample
try { ,,, }
catch ( MyException e)
{ ,,, }
finally
{
DoSomething();
}
Reference
https://cwe.mitre.org/data/definitions/1069.html
Related Technologies
ASP
.Net
JEE
Technical Criterion
Programming Practices - Error and Exception Handling
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.