aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tjwat...@apache.org
Subject svn commit: r1784214 - in /aries/branches/jpa-1.x: jpa-container-advancedtestbundle/pom.xml jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/transaction/impl/JTAEntityManagerHandler.java jpa-container-itest/pom.xml
Date Thu, 23 Feb 2017 22:29:24 GMT
Author: tjwatson
Date: Thu Feb 23 22:29:24 2017
New Revision: 1784214

URL: http://svn.apache.org/viewvc?rev=1784214&view=rev
Log:
Catch Throwable to avoid propagating undeclared exceptions

Modified:
    aries/branches/jpa-1.x/jpa-container-advancedtestbundle/pom.xml
    aries/branches/jpa-1.x/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/transaction/impl/JTAEntityManagerHandler.java
    aries/branches/jpa-1.x/jpa-container-itest/pom.xml

Modified: aries/branches/jpa-1.x/jpa-container-advancedtestbundle/pom.xml
URL: http://svn.apache.org/viewvc/aries/branches/jpa-1.x/jpa-container-advancedtestbundle/pom.xml?rev=1784214&r1=1784213&r2=1784214&view=diff
==============================================================================
--- aries/branches/jpa-1.x/jpa-container-advancedtestbundle/pom.xml (original)
+++ aries/branches/jpa-1.x/jpa-container-advancedtestbundle/pom.xml Thu Feb 23 22:29:24 2017
@@ -30,7 +30,7 @@
 
     <groupId>org.apache.aries.jpa</groupId>
     <artifactId>org.apache.aries.jpa.container.advanced.itest.bundle</artifactId>
-    <version>1.0.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
     <packaging>bundle</packaging>
     <name>Test Bundle for Aries JPA Container advanced iTests</name>
 

Modified: aries/branches/jpa-1.x/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/transaction/impl/JTAEntityManagerHandler.java
URL: http://svn.apache.org/viewvc/aries/branches/jpa-1.x/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/transaction/impl/JTAEntityManagerHandler.java?rev=1784214&r1=1784213&r2=1784214&view=diff
==============================================================================
--- aries/branches/jpa-1.x/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/transaction/impl/JTAEntityManagerHandler.java
(original)
+++ aries/branches/jpa-1.x/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/transaction/impl/JTAEntityManagerHandler.java
Thu Feb 23 22:29:24 2017
@@ -1,6 +1,7 @@
 package org.apache.aries.jpa.container.context.transaction.impl;
 
 import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.Arrays;
 import java.util.HashSet;
@@ -188,6 +189,28 @@ public class JTAEntityManagerHandler imp
           new PersistenceException(NLS.MESSAGES.getMessage("wrong.JPA.version", new Object[]{
               method.getName(), delegate
           }), e);
+        } catch (final Throwable tActual) {
+            Throwable t = tActual;
+
+            while (t != null && t instanceof InvocationTargetException) {
+                t = ((InvocationTargetException) t).getTargetException();
+            }
+            if (t == null) {
+                throw new PersistenceException("unknown invocation target exception", tActual);
+            }
+
+            if (t instanceof RuntimeException) {
+                throw (RuntimeException) t;
+            }
+            if (t instanceof Error) {
+                throw (Error) t;
+            }
+            for (Class<?> declaredException : method.getExceptionTypes()) {
+                if (declaredException.isAssignableFrom(t.getClass())) {
+                    throw t;
+                }
+            }
+            throw new PersistenceException("unexpected un-declared exception " + tActual,
tActual);
         }
         return res;
 

Modified: aries/branches/jpa-1.x/jpa-container-itest/pom.xml
URL: http://svn.apache.org/viewvc/aries/branches/jpa-1.x/jpa-container-itest/pom.xml?rev=1784214&r1=1784213&r2=1784214&view=diff
==============================================================================
--- aries/branches/jpa-1.x/jpa-container-itest/pom.xml (original)
+++ aries/branches/jpa-1.x/jpa-container-itest/pom.xml Thu Feb 23 22:29:24 2017
@@ -301,7 +301,7 @@
         <dependency>
             <groupId>org.apache.aries.jpa</groupId>
             <artifactId>org.apache.aries.jpa.container.advanced.itest.bundle</artifactId>
-            <version>1.0.1-SNAPSHOT</version>
+            <version>2.0.0-SNAPSHOT</version>
             <scope>test</scope>
         </dependency>
         <dependency>



Mime
View raw message