I try to catch ONLY those exceptions that I can deal with.
I HATE code like this:
String s="12";
Integer i;
try {
i = Integer.parseInt(s);
} catch(ParseException pe) {
System.out.println("hihihihihihihi!!!);
}
What I especially hate is that what this usually does is to abort the thread anyway, because three lines later there will be an access to i that will assume that i != null.
Then you will read your stacktrace and scroll and scroll and scroll the log til you find the first signifant mistake that made everything else fall apart.
I wish Java didn't force me to catch Exceptions that I cannot deal with, anyway. But what I can do is this:
catch(Exception e) {
throw new RuntimeException(e);
}
And I declare a lot of "throws" in my function definitions.
I am still dreaming of the day where Eclipse will automatically open a Debugger in the correct line when it will get an uncaught exception. That day, my method will open the correct line.
In other languages, like Smalltalk, I catch only the errors that I can handle. And I happily throw uncaught exceptions when the input does not meet my expectations.
The idea is that I don't want the error to be logged or documented. I want it fixed.