That certainly achieves the goal of closing the ResultSet. Unfortunately, as you're going to find out when you run it, it also has the side effect of returning a closed ResultSet to the caller.
If you want to follow the suggestion given by that product, then the approach you should follow is to not return a ResultSet. Instead, inside the getResults() method you should read through the ResultSet and construct a List<Data>, where Data is a class whose instances each hold one row of the ResultSet. Then return that list to the caller. (And keep that bit about closing the ResultSet in the finally block, that's a good thing.)
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: How to close ResultSet in a function after returning it