Author: doogie
Date: Tue May 14 18:09:38 2013
New Revision: 1482509
URL:
http://svn.apache.org/r1482509Log:
FEATURE: In NoTransaction.call, completely unwrap all nested exceptions, and re-wrap the innermost one. This is just like InTransaction.call.
Modified:
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java?rev=1482509&r1=1482508&r2=1482509&view=diff==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java Tue May 14 18:09:38 2013
@@ -973,15 +973,22 @@ public class TransactionUtil implements
public V call() throws GenericEntityException {
Transaction suspended = TransactionUtil.suspend();
try {
- return callable.call();
+ try {
+ return callable.call();
+ } catch (Throwable t) {
+ while (t.getCause() != null) {
+ t = t.getCause();
+ }
+ throw t;
+ }
+ } catch (GenericEntityException e) {
+ throw e;
} catch (Error e) {
throw e;
} catch (RuntimeException e) {
throw e;
- } catch (GenericEntityException e) {
- throw e;
- } catch (Exception e) {
- throw new GenericEntityException(e);
+ } catch (Throwable t) {
+ throw new GenericEntityException(t);
} finally {
TransactionUtil.resume(suspended);
}