[ https://issues.apache.org/jira/browse/FELIX-5956?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pierre De Rop closed FELIX-5956. -------------------------------- > NPE when invoking a lifecycle runnable method from init method > -------------------------------------------------------------- > > Key: FELIX-5956 > URL: https://issues.apache.org/jira/browse/FELIX-5956 > Project: Felix > Issue Type: Bug > Components: Dependency Manager Runtime > Affects Versions: org.apache.felix.dependencymanager-r1 > Reporter: Pierre De Rop > Assignee: Pierre De Rop > Priority: Major > Fix For: org.apache.felix.dependencymanager-r13 > > > When you use a DM lifecycle controller in order to trigger component > activation from the @Init method, a NPE is throw if you invoke the lifecylce > runnable from the init method. > For example, the following code: > {code:java} > @Component > public class MyServiceImpl implements MyService { > @LifecycleController > volatile Runnable _start; > @Init > void init() { > _start.run(); // immediately trigger service activation > } > } > {code} > produces the following NPE: > {code} > Caused by: java.lang.NullPointerException > at > org.apache.felix.dm.runtime.ToggleServiceDependency.activate(ToggleServiceDependency.java:49) > at > org.apache.felix.dm.runtime.ServiceLifecycleHandler$ComponentStarter.run(ServiceLifecycleHandler.java:431) > at > org.apache.felix.dependencymanager.samples.hello.annot.ServiceProviderImpl.init(ServiceProviderImpl.java:47) > ... 65 more > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)