aspose file tools*
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: 19692
    
  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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Proper way to write try , catch block