View Single Post
Join Date: Jun 2006
Posts: 7,581
Reputation: ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of 
Solved Threads: 461
Super Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Failure as a human

Re: Java and Web Services

 
0
  #4
Jan 13th, 2009
A piece of advice: use a debugger, given that we have no way of reproducing the scenario and the code posted so far looks OK.

BTW, why are you catching a NullPointerException ? Catching unchecked exceptions without any kind of processing is *always* a bad practice and screams of a pre-condition check. Instead put null checks before closing the database resources [like result sets and statements].
  1. Connection conn = null;
  2. Statement stmt = null;
  3. try {
  4. try {
  5. // do something
  6. } finally {
  7. if(stmt != null) stmt.close();
  8. if(conn != null) conn.close();
  9. }
  10. } catch(Exception e) {
  11. e.printStackTrace();
  12. }
I don't accept change; I don't deserve to live.
Reply With Quote