Wether you catch the other SQLException i guess depends on the
situation.  I just find this very useful, wether it's SQL or
otherwise..

Thing thing = getThing();
try {
   thing.use();
} finally {
   thing.close();
}

There is no need to create Thing thing = null; outside the block then
null check it inside.  The only gotchas are:

1. you might want to use a safeClose() to eat exceptions you dont want
overriding others
2. you can't insert any code between the Thing thing = getThing() and
the open of the try.  Otherwise something in there could through and
you will miss the finally.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to