Class CloseResourceRule

  • All Implemented Interfaces:
    JavaParserVisitor, ImmutableLanguage, PropertySource, Rule

    public class CloseResourceRule
    extends AbstractJavaRule
    Makes sure you close your database connections. It does this by looking for code patterned like this:
      Connection c = X;
      try {
       // do stuff, and maybe catch something
      } finally {
       c.close();
      }
     
    Author:
    original author unknown, Contribution from Pierre Mathien