When there is only one callback exception, use its error message in top-level

exception.



git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@453044 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
A. Abram White 2006-10-04 21:52:17 +00:00
parent 361a77c451
commit d0bca27ecd
2 changed files with 15 additions and 5 deletions

View File

@ -670,14 +670,20 @@ public class BrokerImpl
if (exceps.length == 0 || (mode & CALLBACK_IGNORE) != 0)
return;
OpenJPAException ke = new CallbackException(_loc.get("callback-err")).
setNestedThrowables(exceps).setFatal(true);
if ((mode & CALLBACK_ROLLBACK) != 0 && (_flags & FLAG_ACTIVE) != 0)
OpenJPAException ce;
if (exceps.length == 1)
ce = new CallbackException(exceps[0]);
else
ce = new CallbackException(_loc.get("callback-err")).
setNestedThrowables(exceps);
if ((mode & CALLBACK_ROLLBACK) != 0 && (_flags & FLAG_ACTIVE) != 0) {
ce.setFatal(true);
setRollbackOnlyInternal();
}
if ((mode & CALLBACK_LOG) != 0 && _log.isWarnEnabled())
_log.warn(ke);
_log.warn(ce);
if ((mode & CALLBACK_RETHROW) != 0)
throw ke;
throw ce;
}
public void addTransactionListener(Object tl) {

View File

@ -30,6 +30,10 @@ public class CallbackException
super(msg);
}
public CallbackException(Throwable cause) {
super(cause);
}
public int getSubtype() {
return CALLBACK;
}