openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1308565 - in /openwebbeans/trunk: webbeans-impl/src/main/java/org/apache/webbeans/config/ webbeans-impl/src/main/java/org/apache/webbeans/util/ webbeans-tomcat7/src/main/java/org/apache/webbeans/web/tomcat/
Date Mon, 02 Apr 2012 21:05:28 GMT
Author: struberg
Date: Mon Apr  2 21:05:28 2012
New Revision: 1308565

URL: http://svn.apache.org/viewvc?rev=1308565&view=rev
Log:
OWB-659 interfaces, annotations and enums cannot be subject to injection

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
    openwebbeans/trunk/webbeans-tomcat7/src/main/java/org/apache/webbeans/web/tomcat/TomcatWebPlugin.java

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=1308565&r1=1308564&r2=1308565&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
Mon Apr  2 21:05:28 2012
@@ -785,8 +785,7 @@ public class BeansDeployer
         {
             //Fires ProcessInjectionTarget
             processInjectionTargetEvent =
-                webBeansContext.getWebBeansUtil().fireProcessInjectionTargetEventForJavaEeComponents(
-                    clazz);
+                webBeansContext.getWebBeansUtil().fireProcessInjectionTargetEventForJavaEeComponents(clazz);
             webBeansContext.getWebBeansUtil().inspectErrorStack(
                 "There are errors that are added by ProcessInjectionTarget event observers.
Look at logs for further details");
 
@@ -794,7 +793,8 @@ public class BeansDeployer
             if(processInjectionTargetEvent.isSet())
             {
                 //Adding injection target
-                manager.putInjectionTargetWrapperForJavaEeComponents(clazz, new InjectionTargetWrapper<T>(processInjectionTargetEvent.getInjectionTarget()));
               
+                manager.putInjectionTargetWrapperForJavaEeComponents(clazz,
+                        new InjectionTargetWrapper<T>(processInjectionTargetEvent.getInjectionTarget()));
             }
             
             //Checks that not contains @Inject InjectionPoint

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java?rev=1308565&r1=1308564&r2=1308565&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
Mon Apr  2 21:05:28 2012
@@ -403,6 +403,12 @@ public final class WebBeansUtil
      */
     public boolean supportsJavaEeComponentInjections(Class<?> clazz)
     {
+        if (clazz.isInterface() || clazz.isAnnotation() || clazz.isEnum())
+        {
+            // interfaces, annotations and enums are no subject of injection
+            return false;
+        }
+
         // and finally call all checks which are defined in plugins like JSF, JPA, etc
         List<OpenWebBeansPlugin> plugins = webBeansContext.getPluginLoader().getPlugins();
         for (OpenWebBeansPlugin plugin : plugins)

Modified: openwebbeans/trunk/webbeans-tomcat7/src/main/java/org/apache/webbeans/web/tomcat/TomcatWebPlugin.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-tomcat7/src/main/java/org/apache/webbeans/web/tomcat/TomcatWebPlugin.java?rev=1308565&r1=1308564&r2=1308565&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-tomcat7/src/main/java/org/apache/webbeans/web/tomcat/TomcatWebPlugin.java
(original)
+++ openwebbeans/trunk/webbeans-tomcat7/src/main/java/org/apache/webbeans/web/tomcat/TomcatWebPlugin.java
Mon Apr  2 21:05:28 2012
@@ -97,16 +97,16 @@ public class TomcatWebPlugin extends Abs
     public boolean supportsJavaEeComponentInjections(Class<?> clazz)
     {
         if(Servlet.class.isAssignableFrom(clazz) ||
-                Filter.class.isAssignableFrom(clazz) ||
-                ServletContextListener.class.isAssignableFrom(clazz) ||
-                ServletContextAttributeListener.class.isAssignableFrom(clazz) ||
-                HttpSessionActivationListener.class.isAssignableFrom(clazz) ||
-                HttpSessionAttributeListener.class.isAssignableFrom(clazz) ||
-                HttpSessionBindingListener.class.isAssignableFrom(clazz) ||
-                HttpSessionListener.class.isAssignableFrom(clazz) ||
-                ServletRequestListener.class.isAssignableFrom(clazz) ||
-                ServletRequestAttributeListener.class.isAssignableFrom(clazz) ||
-                clazz.isAnnotationPresent(WebService.class))
+           Filter.class.isAssignableFrom(clazz) ||
+           ServletContextListener.class.isAssignableFrom(clazz) ||
+           ServletContextAttributeListener.class.isAssignableFrom(clazz) ||
+           HttpSessionActivationListener.class.isAssignableFrom(clazz) ||
+           HttpSessionAttributeListener.class.isAssignableFrom(clazz) ||
+           HttpSessionBindingListener.class.isAssignableFrom(clazz) ||
+           HttpSessionListener.class.isAssignableFrom(clazz) ||
+           ServletRequestListener.class.isAssignableFrom(clazz) ||
+           ServletRequestAttributeListener.class.isAssignableFrom(clazz) ||
+           clazz.isAnnotationPresent(WebService.class))
         {
             return true;
         }



Mime
View raw message