Injecting Non-Contextual Beans Causes NPE in WebBeansUtil
---------------------------------------------------------
Key: OWB-339
URL: https://issues.apache.org/jira/browse/OWB-339
Project: OpenWebBeans
Issue Type: Bug
Components: Injection and Lookup
Affects Versions: 1.0.0, M4
Reporter: James Carman
Assignee: James Carman
I've got an inject method for injecting non-contextual objects:
@SuppressWarnings("unchecked")
public <T> void inject(T instance)
{
BeanManager mgr = BeanManagerImpl.getManager();
AnnotatedType<T> annotatedType = mgr.createAnnotatedType((Class<T>)
instance.getClass());
InjectionTarget<T> injectionTarget =
mgr.createInjectionTarget(annotatedType);
CreationalContext<T> context = mgr.createCreationalContext(null);
injectionTarget.inject(instance, context);
}
But, when I try it, I get a NPE in WebBeansUtil:
java.lang.NullPointerException
at
org.apache.webbeans.util.WebBeansUtil.getObjectFromCreationalContext(WebBeansUtil.java:2643)
at
org.apache.webbeans.container.BeanManagerImpl.getInjectableReference(BeanManagerImpl.java:733)
at
org.apache.webbeans.inject.AbstractInjectable.inject(AbstractInjectable.java:118)
at
org.apache.webbeans.inject.InjectableField.doInjection(InjectableField.java:54)
at
org.apache.webbeans.component.AbstractInjectionTargetBean.injectField(AbstractInjectionTargetBean.java:354)
at
org.apache.webbeans.component.AbstractInjectionTargetBean.injectFields(AbstractInjectionTargetBean.java:314)
at
org.apache.webbeans.portable.creation.InjectionTargetProducer.inject(InjectionTargetProducer.java:58)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.