You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by st...@apache.org on 2016/09/08 20:38:02 UTC

svn commit: r1759902 - in /openwebbeans/trunk: webbeans-el22/ webbeans-impl/src/main/java/org/apache/webbeans/config/ webbeans-impl/src/main/java/org/apache/webbeans/portable/ webbeans-tomcat7/src/test/java/org/apache/webbeans/web/tomcat7/test/

Author: struberg
Date: Thu Sep  8 20:38:02 2016
New Revision: 1759902

URL: http://svn.apache.org/viewvc?rev=1759902&view=rev
Log:
OWB-1152 improve Java9 support

Modified:
    openwebbeans/trunk/webbeans-el22/pom.xml
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedElementFactory.java
    openwebbeans/trunk/webbeans-tomcat7/src/test/java/org/apache/webbeans/web/tomcat7/test/TomcatNormalScopeProxyFactoryTest.java

Modified: openwebbeans/trunk/webbeans-el22/pom.xml
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-el22/pom.xml?rev=1759902&r1=1759901&r2=1759902&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-el22/pom.xml (original)
+++ openwebbeans/trunk/webbeans-el22/pom.xml Thu Sep  8 20:38:02 2016
@@ -67,8 +67,14 @@
             <groupId>org.apache.geronimo.specs</groupId>
             <artifactId>geronimo-interceptor_1.2_spec</artifactId>
             <scope>provided</scope>
-        </dependency>        
-        
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-annotation_1.2_spec</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java?rev=1759902&r1=1759901&r2=1759902&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java Thu Sep  8 20:38:02 2016
@@ -1216,6 +1216,7 @@ public class BeansDeployer
     {
         logger.fine("Deploying configurations from class files has started.");
 
+        BeanManagerImpl bm = webBeansContext.getBeanManagerImpl();
         for (Map<AnnotatedType<?>, ExtendedBeanAttributes<?>> beanAttributesMap : beanAttributesPerBda.values())
         {
 
@@ -1234,7 +1235,7 @@ public class BeansDeployer
                 // if the implClass already gets processed as part of the
                 // standard BDA scanning, then we don't need to 'additionally'
                 // deploy it anymore.
-                webBeansContext.getBeanManagerImpl().removeAdditionalAnnotatedType(annotatedType.getKey());
+                bm.removeAdditionalAnnotatedType(annotatedType.getKey());
 
             }
         }
@@ -1273,7 +1274,7 @@ public class BeansDeployer
             }
             catch (NoClassDefFoundError ncdfe)
             {
-                logger.info("Skipping deployment of Class " + beanClass + "due to a NoClassDefFoundError: " + ncdfe.getMessage());
+                logger.warning("Skipping deployment of Class " + beanClass + " due to a NoClassDefFoundError: " + ncdfe.getMessage());
             }
         }
     }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedElementFactory.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedElementFactory.java?rev=1759902&r1=1759901&r2=1759902&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedElementFactory.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedElementFactory.java Thu Sep  8 20:38:02 2016
@@ -326,10 +326,9 @@ public final class AnnotatedElementFacto
         {
             return cast(methods);
         }
-        methods = Collections.unmodifiableSet(getFilteredMethods(
-                annotatedType.getJavaClass(),
-                (Set<AnnotatedMethod<?>>)(Set<?>)annotatedType.getMethods(),
-                new HashSet<AnnotatedMethod<?>>()));
+        methods = Collections.unmodifiableSet(getFilteredMethods(annotatedType.getJavaClass(),
+                                                                 (Set)annotatedType.getMethods(),
+                                                                 new HashSet<AnnotatedMethod<?>>()));
         Set<AnnotatedMethod<?>> old = annotatedMethodsOfTypeCache.putIfAbsent(annotatedType, methods);
         if (old != null)
         {

Modified: openwebbeans/trunk/webbeans-tomcat7/src/test/java/org/apache/webbeans/web/tomcat7/test/TomcatNormalScopeProxyFactoryTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-tomcat7/src/test/java/org/apache/webbeans/web/tomcat7/test/TomcatNormalScopeProxyFactoryTest.java?rev=1759902&r1=1759901&r2=1759902&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-tomcat7/src/test/java/org/apache/webbeans/web/tomcat7/test/TomcatNormalScopeProxyFactoryTest.java (original)
+++ openwebbeans/trunk/webbeans-tomcat7/src/test/java/org/apache/webbeans/web/tomcat7/test/TomcatNormalScopeProxyFactoryTest.java Thu Sep  8 20:38:02 2016
@@ -21,6 +21,7 @@ package org.apache.webbeans.web.tomcat7.
 import org.apache.catalina.Context;
 import org.apache.catalina.connector.Request;
 import org.apache.catalina.connector.Response;
+import org.apache.catalina.core.StandardContext;
 import org.apache.catalina.startup.Tomcat;
 import org.apache.tomcat.util.http.fileupload.IOUtils;
 import org.apache.webbeans.config.WebBeansContext;
@@ -41,12 +42,16 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.Writer;
 import java.lang.reflect.Method;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import static java.util.Arrays.asList;
 import static org.junit.Assert.assertEquals;
 
 public class TomcatNormalScopeProxyFactoryTest
 {
+    private static final Logger log = Logger.getLogger(TomcatNormalScopeProxyFactoryTest.class.getName());
+
     @Test
     public void checkDeserialisation() throws Exception
     {
@@ -63,6 +68,11 @@ public class TomcatNormalScopeProxyFacto
             final Context ctx = tomcat.addContext("/test", war.getAbsolutePath());
             ctx.addLifecycleListener(new ContextLifecycleListener());
 
+            // needed for Java9
+            if (ctx instanceof StandardContext) {
+                ((StandardContext) ctx).setClearReferencesRmiTargets(false);
+            }
+
             tomcat.start();
 
             try
@@ -114,6 +124,9 @@ public class TomcatNormalScopeProxyFacto
                     // don't do to not destroy the instance
                     // contextsService.endContext(SessionScoped.class, request.getSession());
                 }
+                catch (Exception e) {
+                    log.log(Level.SEVERE, "Exception during test execution", e);
+                }
                 finally
                 {
                     thread.setContextClassLoader(old);
@@ -121,7 +134,15 @@ public class TomcatNormalScopeProxyFacto
             }
             finally
             {
-                tomcat.stop();
+                try
+                {
+                    tomcat.stop();
+                }
+                catch (Exception e)
+                {
+                    log.log(Level.SEVERE, "This _might_ happen on Java9 currently. I hope it gets soon fixed.", e);
+                }
+
             }
         }
     }