SessionBean does not pass information about exception thrown in handler method
------------------------------------------------------------------------------
Key: CORE-47
URL: http://galaxy.andromda.org:8080/jira/browse/CORE-47
Project: AndroMDA Core
Type: Improvement
Reporter: Sverker Abrahamsson
Assigned to: Chad Brandon
It have happened several times for me that when an exception thrown in a
handler method in the Impl class, the information about what acctually happened
is not passed on to the caller because the business method in the SessionBean
catch all Throwables and throw a new EJBExcption with only the message. The
stacktrace of where the original exception was thrown is lost.
Say that e.g. my handler method throws a NullPointerException because of some
bug. It is then important for me to know exactly where that happened. This
patch solves that:
diff -u -r1.12 HibernateSessionBean.vsl
---
cartridges/andromda-hibernate/src/templates/hibernate/ejb/HibernateSessionBean.vsl
6 Mar 2005 21:33:39 -0000 1.12
+++
cartridges/andromda-hibernate/src/templates/hibernate/ejb/HibernateSessionBean.vsl
14 Mar 2005 01:21:51 -0000
@@ -109,7 +109,12 @@
#end
catch (Throwable th)
{
- throw new EJBException("${service.name}Bean.${operation.name}: " +
th.toString());
+ this.ctx.setRollbackOnly();
+ if(th instanceof Exception) {
+ throw new EJBException("${service.name}Bean.${operation.name}:
" + th.toString(), (Exception) th);
+ } else {
+ throw new EJBException("${service.name}Bean.${operation.name}:
" + th.toString());
+ }
}
finally
{
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://galaxy.andromda.org:8080/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Andromda-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/andromda-devel