try catch blocks

16 views
Skip to first unread message

Peeyush Tuli

unread,
Jan 16, 2015, 4:48:09 AM1/16/15
to jmapper-...@googlegroups.com, Pinaki Ashar, Shashank Tandon
Hello,

while checking the jmapper code , i see many functions have a try catch block like this -

try{

....

}catch (Exception e) { JmapperLog.ERROR(e); }

Is there a reason to suppress like this?


This e-mail message may contain confidential or legally privileged information and is intended only for the use of the intended recipient(s). Any unauthorized disclosure, dissemination, distribution, copying or the taking of any action in reliance on the information herein is prohibited. E-mails are not secure and cannot be guaranteed to be error free as they can be intercepted, amended, or contain viruses. Anyone who communicates with us by e-mail is deemed to have accepted these risks. Company Name is not responsible for errors or omissions in this message and denies any responsibility for any damage arising from the use of e-mail. Any opinion and other statement contained in this message and any attachment are solely those of the author and do not necessarily represent those of the company.

P please consider the environment before printing this e-mail

Alessandro Vurro

unread,
Jan 18, 2015, 9:09:19 AM1/18/15
to jmapper-...@googlegroups.com, Pinaki...@newscyclesolutions.com, shas...@mds.org.in
Hi Peeyush,

this is the JMapperLog.Error method:

        public static void ERROR(Exception e){
logger.error("{}: {}",e.getClass().getSimpleName(),e.getMessage());
e.printStackTrace();
}

the purpose is to avoid the explicit handling of the exceptions. 
Some exceptions thrown by javassist are extensions of the Exception class. 
The alternative is to wrap the exception in a runtime exception and rethrown, do you think this last is a good solution ?
Reply all
Reply to author
Forward
0 new messages