Compilation fix

- Required by a merge that skipped a few revisions
 - Will merge fine when it eventually gets hit


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13543 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2009-03-11 00:13:19 +00:00
parent dcf229bf78
commit 6773e2f1ce

View File

@@ -24,6 +24,10 @@
*/
package org.alfresco.web.ui.common;
import javax.transaction.UserTransaction;
import org.alfresco.repo.transaction.RetryingTransactionHelper;
/**
* Unchecked exception wrapping an already-reported exception. The dialog code can use this to
* detect whether or not to report further to the user.
@@ -39,4 +43,24 @@ public class ReportedException extends RuntimeException
{
super(e);
}
/**
* Throws the given exception if we are still in an active transaction,
* this ensures that we cross the transaction boundary and thus cause
* the transaction to rollback.
*
* @param error The error to be thrown
* @throws Throwable
*/
public static void throwIfNecessary(Throwable error)
{
if (error != null)
{
UserTransaction txn = RetryingTransactionHelper.getActiveUserTransaction();
if (txn != null)
{
throw new ReportedException(error);
}
}
}
}