openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject [openwebbeans] branch master updated: OWB-1309 fix missing NoSuchMethodException
Date Sat, 11 Jan 2020 14:28:39 GMT
This is an automated email from the ASF dual-hosted git repository.

struberg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwebbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new 5ab9f4b  OWB-1309 fix missing NoSuchMethodException
5ab9f4b is described below

commit 5ab9f4bbdb9ab31528519c679f12cc616c68e5e8
Author: Mark Struberg <struberg@apache.org>
AuthorDate: Sat Jan 11 15:27:34 2020 +0100

    OWB-1309 fix missing NoSuchMethodException
    
    This is a new Exception which got introduced by Tomcat and broke
    backward compatibility.
---
 pom.xml                                            |  2 +-
 .../web/tomcat7/TomcatInstanceManager.java         | 53 ++++++++++++++++------
 2 files changed, 40 insertions(+), 15 deletions(-)

diff --git a/pom.xml b/pom.xml
index f3be5e4..cdbf1ed 100644
--- a/pom.xml
+++ b/pom.xml
@@ -70,7 +70,7 @@
         <geronimo_atinject.version>1.1</geronimo_atinject.version>
         <geronimo_interceptor.version>1.1</geronimo_interceptor.version>
         <geronimo_validation.version>1.1</geronimo_validation.version>
-        <tomcat7.version>7.0.73</tomcat7.version>
+        <tomcat7.version>7.0.99</tomcat7.version>
         <!-- jetty 9.4.13+ broke session persistence: https://github.com/eclipse/jetty.project/issues/3597
-->
         <jetty.version>9.4.12.v20180830</jetty.version>
         <myfaces.version>2.3.6</myfaces.version>
diff --git a/webbeans-tomcat7/src/main/java/org/apache/webbeans/web/tomcat7/TomcatInstanceManager.java
b/webbeans-tomcat7/src/main/java/org/apache/webbeans/web/tomcat7/TomcatInstanceManager.java
index 77e1efb..e303ad6 100644
--- a/webbeans-tomcat7/src/main/java/org/apache/webbeans/web/tomcat7/TomcatInstanceManager.java
+++ b/webbeans-tomcat7/src/main/java/org/apache/webbeans/web/tomcat7/TomcatInstanceManager.java
@@ -27,6 +27,7 @@ import javax.naming.NamingException;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.InstanceManager;
+import org.apache.webbeans.util.ExceptionUtil;
 
 public class TomcatInstanceManager implements InstanceManager
 {
@@ -70,24 +71,40 @@ public class TomcatInstanceManager implements InstanceManager
     public Object newInstance(Class<?> aClass) throws IllegalAccessException, InvocationTargetException,
NamingException, InstantiationException
     {
         // Creates a defaut instance
-        Object object = this.processor.newInstance(aClass);
+        try
+        {
+            Object object = this.processor.newInstance(aClass);
 
-        // Inject dependencies
-        inject(object);
+            // Inject dependencies
+            inject(object);
 
-        return object;
+            return object;
+        }
+        catch (Exception e)
+        {
+            // sadly this is required as the Tomcat InstanceManager introduced an additional
Exception in their signature :(
+            throw ExceptionUtil.throwAsRuntimeException(e);
+        }
     }
 
     @Override
     public Object newInstance(String str) throws IllegalAccessException, InvocationTargetException,
NamingException, InstantiationException, ClassNotFoundException
     {
-        // Creates a defaut instance
-        Object object = this.processor.newInstance(str);
+        try
+        {
+            // Creates a defaut instance
+            Object object = this.processor.newInstance(str);
 
-        // Inject dependencies
-        inject(object);
+            // Inject dependencies
+            inject(object);
 
-        return object;
+            return object;
+        }
+        catch (Exception e)
+        {
+            // sadly this is required as the Tomcat InstanceManager introduced an additional
Exception in their signature :(
+            throw ExceptionUtil.throwAsRuntimeException(e);
+        }
     }
 
     @Override
@@ -100,13 +117,21 @@ public class TomcatInstanceManager implements InstanceManager
     @Override
     public Object newInstance(String str, ClassLoader cl) throws IllegalAccessException,
InvocationTargetException, NamingException, InstantiationException, ClassNotFoundException
     {
-        // Creates a defaut instance
-        Object object = this.processor.newInstance(str, cl);
+        try
+        {
+            // Creates a defaut instance
+            Object object = this.processor.newInstance(str, cl);
 
-        // Inject dependencies
-        inject(object);
+            // Inject dependencies
+            inject(object);
 
-        return object;
+            return object;
+        }
+        catch (Exception e)
+        {
+            // sadly this is required as the Tomcat InstanceManager introduced an additional
Exception in their signature :(
+            throw ExceptionUtil.throwAsRuntimeException(e);
+        }
     }
 
     private void inject(Object object)


Mime
View raw message