There were several places in the code base where an object was opened and it had the possibility of not being closed if an error was thrown.
Since the objects that I saw already implemented the Closable interface, I went ahead and added a try with resources to automatically close the objects upon error/final usage of the object. This helps to prevent memory leaks and is a best practice.
There were several places in the code base where an object was opened and it had the possibility of not being closed if an error was thrown.
Since the objects that I saw already implemented the Closable interface, I went ahead and added a try with resources to automatically close the objects upon error/final usage of the object. This helps to prevent memory leaks and is a best practice.