mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
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:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user