[jboss-cvs] jboss-seam/src/main/org/jboss/seam/web ...
Gavin King
gavin.king at jboss.com
Wed May 30 14:53:47 EDT 2007
User: gavin
Date: 07/05/30 14:53:47
Modified: src/main/org/jboss/seam/web ExceptionFilter.java
Log:
apply JBSEAM-1144
make Transaction management be a component that implements UserTransaction
no longer need to roll back txns at end of request, due to JBAS-3242 being fixed
Revision Changes Path
1.8 +8 -17 jboss-seam/src/main/org/jboss/seam/web/ExceptionFilter.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ExceptionFilter.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/web/ExceptionFilter.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- ExceptionFilter.java 4 May 2007 11:31:34 -0000 1.7
+++ ExceptionFilter.java 30 May 2007 18:53:47 -0000 1.8
@@ -27,12 +27,13 @@
import org.jboss.seam.annotations.Startup;
import org.jboss.seam.contexts.Lifecycle;
import org.jboss.seam.core.Exceptions;
+import org.jboss.seam.core.Transaction;
import org.jboss.seam.log.LogProvider;
import org.jboss.seam.log.Logging;
import org.jboss.seam.mock.MockApplication;
import org.jboss.seam.mock.MockExternalContext;
import org.jboss.seam.mock.MockFacesContext;
-import org.jboss.seam.util.Transactions;
+import org.jboss.seam.util.EJB;
/**
* As a last line of defence, rollback uncommitted transactions
@@ -57,23 +58,11 @@
try
{
chain.doFilter(request, response);
-
- //There is a bug in JBoss AS where JBoss does not clean up
- //any orphaned tx at the end of the request. It is possible
- //that a Seam-managed tx could be left orphaned if, eg.
- //facelets handles an exceptions and displays the debug page.
- rollbackTransactionIfNecessary();
}
catch (Exception e)
{
log.error("uncaught exception", e);
- if (e instanceof ServletException)
- {
- log.error("exception root cause", ( (ServletException) e ).getRootCause() );
- } else {
- log.error("exception cause", e.getCause());
- }
- rollbackTransactionIfNecessary();
+ log.error( "exception root cause", EJB.getCause(e) );
endWebRequestAfterException( (HttpServletRequest) request, (HttpServletResponse) response, e);
}
finally
@@ -92,6 +81,7 @@
Lifecycle.beginExceptionRecovery( facesContext.getExternalContext() );
try
{
+ rollbackTransactionIfNecessary();
Exceptions.instance().handle(e);
}
catch (ServletException se)
@@ -128,11 +118,12 @@
protected void rollbackTransactionIfNecessary()
{
- try {
- if ( Transactions.isTransactionActiveOrMarkedRollback() )
+ try
+ {
+ if ( Transaction.instance().isActiveOrMarkedRollback() )
{
log.debug("killing transaction");
- Transactions.getUserTransaction().rollback();
+ Transaction.instance().rollback();
}
}
catch (Exception te)
More information about the jboss-cvs-commits
mailing list