The rule checks if allocated resource is properly diposed.
It follows try/finally pattern.
It is configurable via parameters.
Example configuration:
javax.sql.DataSource:getConnection:java.sql.Connection:close
Where:
- "javax.sql.DataSource" is a full class name for the resource allocator
- "getConnection" is a method name of the class that allocates resource
- "java.sql.Connection" is a full class name for the resource DE-allocator
- "close" is a method name of the class that DE-allocates resource
The following code will be checked by the paramemeter above:
javax.sql.DataSource ds;
// connection is allocated here...
java.sql.Connection conn = ds.getConnection();
...
// connection is "returned" back to data source...
conn.close();
author: zorror8080 version: $Revision: 1.9 $ |