aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject svn commit: r1704662 - in /aries/trunk/jpa/jpa-support/src/main/java/org/apache/aries/jpa/support/impl: AbstractJpaTemplate.java ResourceLocalJpaTemplate.java XAJpaTemplate.java
Date Tue, 22 Sep 2015 15:58:38 GMT
Author: cschneider
Date: Tue Sep 22 15:58:33 2015
New Revision: 1704662

URL: http://svn.apache.org/viewvc?rev=1704662&view=rev
Log:
[ARIES-1415] Adding message to wrapped exceptions, do not wrap Error instances

Modified:
    aries/trunk/jpa/jpa-support/src/main/java/org/apache/aries/jpa/support/impl/AbstractJpaTemplate.java
    aries/trunk/jpa/jpa-support/src/main/java/org/apache/aries/jpa/support/impl/ResourceLocalJpaTemplate.java
    aries/trunk/jpa/jpa-support/src/main/java/org/apache/aries/jpa/support/impl/XAJpaTemplate.java

Modified: aries/trunk/jpa/jpa-support/src/main/java/org/apache/aries/jpa/support/impl/AbstractJpaTemplate.java
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/jpa-support/src/main/java/org/apache/aries/jpa/support/impl/AbstractJpaTemplate.java?rev=1704662&r1=1704661&r2=1704662&view=diff
==============================================================================
--- aries/trunk/jpa/jpa-support/src/main/java/org/apache/aries/jpa/support/impl/AbstractJpaTemplate.java
(original)
+++ aries/trunk/jpa/jpa-support/src/main/java/org/apache/aries/jpa/support/impl/AbstractJpaTemplate.java
Tue Sep 22 15:58:33 2015
@@ -48,10 +48,10 @@ public abstract class AbstractJpaTemplat
     }
 
 
-    protected RuntimeException wrapThrowable(Throwable ex) {
+    protected RuntimeException wrapThrowable(Throwable ex, String message) {
         if (ex instanceof RuntimeException) {
             return (RuntimeException) ex;
         }
-        return new RuntimeException(ex);
+        return new RuntimeException(message, ex);
     }
 }

Modified: aries/trunk/jpa/jpa-support/src/main/java/org/apache/aries/jpa/support/impl/ResourceLocalJpaTemplate.java
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/jpa-support/src/main/java/org/apache/aries/jpa/support/impl/ResourceLocalJpaTemplate.java?rev=1704662&r1=1704661&r2=1704662&view=diff
==============================================================================
--- aries/trunk/jpa/jpa-support/src/main/java/org/apache/aries/jpa/support/impl/ResourceLocalJpaTemplate.java
(original)
+++ aries/trunk/jpa/jpa-support/src/main/java/org/apache/aries/jpa/support/impl/ResourceLocalJpaTemplate.java
Tue Sep 22 15:58:33 2015
@@ -62,7 +62,7 @@ public class ResourceLocalJpaTemplate ex
             if (weControlTx) {
                 safeRollback(em, e);
             }
-            throw wrapThrowable(e);
+            throw wrapThrowable(e, "Exception occured in transactional code");
         } finally {
             coord.end();
         }

Modified: aries/trunk/jpa/jpa-support/src/main/java/org/apache/aries/jpa/support/impl/XAJpaTemplate.java
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/jpa-support/src/main/java/org/apache/aries/jpa/support/impl/XAJpaTemplate.java?rev=1704662&r1=1704661&r2=1704662&view=diff
==============================================================================
--- aries/trunk/jpa/jpa-support/src/main/java/org/apache/aries/jpa/support/impl/XAJpaTemplate.java
(original)
+++ aries/trunk/jpa/jpa-support/src/main/java/org/apache/aries/jpa/support/impl/XAJpaTemplate.java
Tue Sep 22 15:58:33 2015
@@ -62,14 +62,17 @@ public class XAJpaTemplate extends Abstr
             return result;
         } catch (Throwable ex) {
             safeRollback(tranToken, ex);
-            throw wrapThrowable(ex);
+            if (ex instanceof Error) {
+                throw (Error)ex;
+            }
+            throw wrapThrowable(ex, "Exception occured in transactional code");
         } finally {
             try {
                 ta.finish(tm, tranToken);
             } catch (Exception e) {
                 // We are throwing an exception, so we don't error it out
                 LOGGER.debug("Exception during finish of transaction", e);
-                throw new RuntimeException("Exception during finish of transaction", e);
+                throw wrapThrowable(e, "Exception during finish of transaction");
             } finally {
                 coord.end();
             }



Mime
View raw message