File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes why should not caught Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "why should not caught Exception" Watch "why should not caught Exception" New topic
Author

why should not caught Exception

pooja jain
greenhorn
Ranch Hand

Joined: Jan 12, 2005
Posts: 213


I know that this is not recommended , but what exactly the reason ?
In which situation , it is recommended ?
In K&B book it is given that , you will not get proper message ( log ) if you will use this , I am not getting why ?
e.printStackTrace() will be called based on object ( Exception ) type ( late binding ) , so I think we will get proper message .

please help me .
Thanks in advance .


:d
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3829
One reason may be this : In real project , we never just write printStackTrace() method in a catch block , we do something specific depends on exception type .

Like if there is FileNotFoundException then we can provide any local file . So we catch exception separately & do something specific for them .

In which situation , it is recommended ?

Well , I don't think , it is recommended in any situation .
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: why should not caught Exception
 
Similar Threads
Writing bytes out to a socket
read the contents of the Directory & then read a file from the directory
Insert for mysql
WSDP and AXIS
executeUpdate not updating and no exception thrown