== Why is this an issue? include::../description.adoc[] include::../noncompliant.adoc[] include::../compliant.adoc[] === Exceptions Instances of the following classes are ignored by this rule because ``++close++`` has no effect: * ``++java.io.ByteArrayOutputStream++`` * ``++java.io.ByteArrayInputStream++`` * ``++java.io.CharArrayReader++`` * ``++java.io.CharArrayWriter++`` * ``++java.io.StringReader++`` * ``++java.io.StringWriter++`` Java 7 introduced the try-with-resources statement, which implicitly closes ``++Closeables++``. All resources opened in a try-with-resources statement are ignored by this rule. ---- try (BufferedReader br = new BufferedReader(new FileReader(fileName))) { //... } catch ( ... ) { //... } ---- == Resources * https://cwe.mitre.org/data/definitions/459[MITRE, CWE-459] - Incomplete Cleanup * https://cwe.mitre.org/data/definitions/772[MITRE, CWE-772] - Missing Release of Resource after Effective Lifetime * https://wiki.sei.cmu.edu/confluence/x/vjdGBQ[CERT, FIO04-J.] - Release resources when they are no longer needed * https://wiki.sei.cmu.edu/confluence/x/QtUxBQ[CERT, FIO42-C.] - Close files when they are no longer needed * https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html[Try With Resources] ifdef::env-github,rspecator-view[] ''' == Implementation Specification (visible only on this page) include::../message.adoc[] include::parameters.adoc[] ''' == Comments And Links (visible only on this page) include::../comments-and-links.adoc[] endif::env-github,rspecator-view[]