mirror of https://github.com/apache/openjpa.git
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:
parent
361a77c451
commit
d0bca27ecd
|
@ -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) {
|
||||
|
|
|
@ -30,6 +30,10 @@ public class CallbackException
|
|||
super(msg);
|
||||
}
|
||||
|
||||
public CallbackException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public int getSubtype() {
|
||||
return CALLBACK;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue