This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Proper way to write try , catch block Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Proper way to write try , catch block" Watch "Proper way to write try , catch block" New topic
Author

Proper way to write try , catch block

S Majumder
Ranch Hand

Joined: Jun 03, 2009
Posts: 244
Hi every body , I have a code something like below :




Is this the proper way to duck and catch the exception ?

Thanks and regards,
S
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19697
    
  20

Why are you catching an exception with a lot of detail information most importantly its type), then wrap it in a generic Exception? Just don't catch the exception and let the method simply throw it:
Moving to Beginning Java.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
 
subject: Proper way to write try , catch block