openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1798874 - /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
Date Thu, 15 Jun 2017 20:36:18 GMT
Author: struberg
Date: Thu Jun 15 20:36:18 2017
New Revision: 1798874

URL: http://svn.apache.org/viewvc?rev=1798874&view=rev
Log:
OWB-1182 verify stereotypes of custom BeanAttributes

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.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=1798874&r1=1798873&r2=1798874&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 Jun 15 20:36:18 2017
@@ -439,16 +439,29 @@ public class BeansDeployer
                 {
                     if (isEjb || (ClassUtil.isConcrete(beanClass) || WebBeansUtil.isDecorator(at))
&& isValidManagedBean(at))
                     {
-                        final BeanAttributesImpl tBeanAttributes = BeanAttributesBuilder.forContext(webBeansContext).newBeanAttibutes(at,
onlyScopedBeans).build();
-                        if (tBeanAttributes != null &&
-                                (!tBeanAttributes.isAlternative() || webBeansContext.getAlternativesManager()
-                                        .isAlternative(at.getJavaClass(), tBeanAttributes.getStereotypes())))
+                        final BeanAttributesImpl beanAttributes = BeanAttributesBuilder.forContext(webBeansContext).newBeanAttibutes(at,
onlyScopedBeans).build();
+                        if (beanAttributes != null &&
+                                (!beanAttributes.isAlternative() || webBeansContext.getAlternativesManager()
+                                        .isAlternative(at.getJavaClass(), beanAttributes.getStereotypes())))
                         {
                             final ProcessBeanAttributesImpl<?> processBeanAttributes
-                                = webBeansContext.getWebBeansUtil().fireProcessBeanAttributes(at,
at.getJavaClass(), tBeanAttributes);
+                                = webBeansContext.getWebBeansUtil().fireProcessBeanAttributes(at,
at.getJavaClass(), beanAttributes);
                             if (processBeanAttributes != null)
                             {
-                                bdaBeanAttributes.put(at, new ExtendedBeanAttributes(processBeanAttributes.getAttributes(),
isEjb, processBeanAttributes.isIgnoreFinalMethods()));
+                                BeanAttributes<?> newBeanAttributes = processBeanAttributes.getAttributes();
+                                if (beanAttributes != newBeanAttributes)
+                                {
+                                    // check stereotypes
+                                    for (Class<? extends Annotation> stereotype : newBeanAttributes.getStereotypes())
+                                    {
+                                        if (!webBeansContext.getBeanManagerImpl().isStereotype((stereotype)))
+                                        {
+                                            throw new WebBeansConfigurationException("Custom
BeanAttributes#getStereotypes() must only contain Stereotypes!");
+                                        }
+                                    }
+                                }
+
+                                bdaBeanAttributes.put(at, new ExtendedBeanAttributes(newBeanAttributes,
isEjb, processBeanAttributes.isIgnoreFinalMethods()));
                             }
                         }
                     }



Mime
View raw message