Well, that just means that whatever is in your list, they aren't Strings. Which doesn't surprise me as you're selecting entire rows, not single values. The details of the exception should have told you what they actually are.
And quite apart from Matthew's good advice:really isn't much better than:because it doesn't stop your program; and that means that, depending on what you're doing, you could have millions of those messages to plough through.
Until you're ready to publish, or you know that the exception can be recovered from, you're much better off simply letting the program fail - ie, don't use try...catch; or, if you want to avoid throws clauses, simply re-throw the exception as a RuntimeException or java.lang.Error, viz:That way, your program will stop as soon as it hits a problem, and you will always get a stack trace.
Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
That is unnecessary; the toString method is called automatically by println, so you can reduce that toAlso, that code will not fail if the Iterator returns null, as you can find out from the println documentation and this method which it calls.