openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1606885 - in /openwebbeans/trunk: webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointImpl.java webbeans-tck/testng-dev.xml
Date Mon, 30 Jun 2014 19:15:16 GMT
Author: rmannibucau
Date: Mon Jun 30 19:15:15 2014
New Revision: 1606885

URL: http://svn.apache.org/r1606885
Log:
some validation of injection points, should surely be clean up a bit later

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointImpl.java
    openwebbeans/trunk/webbeans-tck/testng-dev.xml

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java?rev=1606885&r1=1606884&r2=1606885&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
Mon Jun 30 19:15:15 2014
@@ -751,7 +751,19 @@ public class BeanManagerImpl implements 
 
     public InjectionPoint createInjectionPoint(AnnotatedParameter<?> parameter)
     {
-        return webBeansContext.getInjectionPointFactory().buildInjectionPoint(null, parameter);
+        final InjectionPoint injectionPoint = webBeansContext.getInjectionPointFactory().buildInjectionPoint(null,
parameter);
+        if (AnnotatedMethod.class.isInstance(parameter.getDeclaringCallable()))
+        {
+            try
+            {
+                validate(injectionPoint);
+            }
+            catch (final Exception e)
+            {
+                throw new IllegalArgumentException(e);
+            }
+        } // TODO else constructor rules are a bit different
+        return injectionPoint;
     }
 
     public <X> ProducerFactory<X> getProducerFactory(AnnotatedField<? super
X> field, Bean<X> bean)

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointImpl.java?rev=1606885&r1=1606884&r2=1606885&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointImpl.java
Mon Jun 30 19:15:15 2014
@@ -74,7 +74,8 @@ class InjectionPointImpl implements Inje
     InjectionPointImpl(Bean<?> ownerBean, Collection<Annotation> qualifiers,
AnnotatedField<?> annotatedField)
     {
         this(ownerBean, annotatedField.getBaseType(), qualifiers, annotatedField,
-                annotatedField.getJavaMember(), annotatedField.isAnnotationPresent(Delegate.class),
Modifier.isTransient(annotatedField.getJavaMember().getModifiers()));
+                annotatedField.getJavaMember(), annotatedField.isAnnotationPresent(Delegate.class),
+                annotatedField.getJavaMember() == null? false : Modifier.isTransient(annotatedField.getJavaMember().getModifiers()));
     }
     
     InjectionPointImpl(Bean<?> ownerBean, Collection<Annotation> qualifiers,
AnnotatedParameter<?> parameter)
@@ -93,7 +94,14 @@ class InjectionPointImpl implements Inje
     
     private InjectionPointImpl(Bean<?> ownerBean, Type type, Collection<Annotation>
qualifiers, Annotated annotated, Member member, boolean delegate, boolean isTransient)
     {
-        Asserts.assertNotNull(type, "required type may not be null");
+        if (type == null)
+        {
+            throw new IllegalArgumentException("type is null");
+        }
+        if (member == null)
+        {
+            throw new IllegalArgumentException("member is null");
+        }
         Asserts.assertNotNull(qualifiers, "qualifiers may not be null");
         this.ownerBean = ownerBean;
         injectionType = type;
@@ -105,7 +113,7 @@ class InjectionPointImpl implements Inje
         if(!WebBeansUtil.checkObtainsInjectionPointConditions(this))
         {
             EventUtil.checkObservableInjectionPointConditions(this);
-        }        
+        }
     }
     
     @Override

Modified: openwebbeans/trunk/webbeans-tck/testng-dev.xml
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-tck/testng-dev.xml?rev=1606885&r1=1606884&r2=1606885&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-tck/testng-dev.xml (original)
+++ openwebbeans/trunk/webbeans-tck/testng-dev.xml Mon Jun 30 19:15:15 2014
@@ -19,7 +19,7 @@
   <test name="JSR-346 TCK">
     <classes>
       <class
-          name="org.jboss.cdi.tck.interceptors.tests.contract.aroundConstruct.AroundConstructTest"
/>
+          name="org.jboss.cdi.tck.tests.extensions.beanManager.injectionPoint.CreateInjectionPointTest"
/>
     </classes>
     <groups>
       <run>



Mime
View raw message