My team has quite a huge amount of code. Recently I have found some objects that weren't closed properly.
How can i find all the instances that are not closed or not inside a try-with-resources
block?
Some objects like Statement
, ResultSet
are not showing warning messages for it, even.
Is there an extension tool for showing all this occurrences?
I'm using Eclipse.
Static code analysis tools like Sonar should find all those occurrences and warn you about them.
IDEA IntelliJ's inspection profiles also includes some rules for that (Settings > Editor > Inspections > Java > Resource management issues, or just filter by "close" inside Inspections).
I see that you're using Eclipse. You can probably install the FindBugs Eclipse plugin, which includes a couple of rules to check if resources are properly closed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With