rspec/rules/S2095/description.adoc

5 lines
629 B
Plaintext
Raw Normal View History

2021-01-27 13:42:22 +01:00
Connections, streams, files, and other classes that implement the ``++Closeable++`` interface or its super-interface, ``++AutoCloseable++``, needs to be closed after use. Further, that ``++close++`` call must be made in a ``++finally++`` block otherwise an exception could keep the call from being made. Preferably, when class implements ``++AutoCloseable++``, resource should be created using "try-with-resources" pattern and will be closed automatically.
2020-06-30 12:48:07 +02:00
2021-02-02 15:02:10 +01:00
Failure to properly close resources will result in a resource leak which could bring first the application and then perhaps the box the application is on to their knees.