Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
org.apache.felix.dependencymanager-r1
-
None
Description
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:
@Component public class MyServiceImpl implements MyService { @LifecycleController volatile Runnable _start; @Init void init() { _start.run(); // immediately trigger service activation } }
produces the following NPE:
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