You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by "James Carman (JIRA)" <ji...@apache.org> on 2010/03/27 16:06:27 UTC
[jira] Updated: (OWB-339) Injecting Non-Contextual Beans Causes NPE
in WebBeansUtil
[ https://issues.apache.org/jira/browse/OWB-339?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
James Carman updated OWB-339:
-----------------------------
Attachment: OWB-339.patch
Here's a patch that fixes it for my test case.
> 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
> Attachments: OWB-339.patch
>
>
> 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.