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. Thus an empty finally block is most probably the sign of potential "resource leaks" that will jeopardize the application's stability.
Violation Code Sample
try { ... }
catch ( MyException e)
{ ,,, }
finally
{
// DO NOTHING <= VIOLATION
}
Fixed Code Sample
try { ,,, }
catch ( MyException e)
{ ,,, }
finally
{
DoSomething();
}
Related Technologies
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.