Skip to content

Latest commit

 

History

History
16 lines (14 loc) · 470 Bytes

CloseResource.md

File metadata and controls

16 lines (14 loc) · 470 Bytes

CloseResource

Category: pmd
Rule Key: pmd:CloseResource

⚠️ This rule is deprecated in favour of S2095.


Ensure that resources (like Connection, Statement, and ResultSet objects) are always closed after use. It does this by looking for code patterned like :

Connection c = openConnection();
try {
  // do stuff, and maybe catch something
} finally {
  c.close();
}