You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "David Jencks (JIRA)" <ji...@apache.org> on 2013/10/21 23:46:43 UTC

[jira] [Created] (FELIX-4287) [DS] NPE when calling ComponentInstance.dispose after bundle shut down

David Jencks created FELIX-4287:
-----------------------------------

             Summary: [DS] NPE when calling ComponentInstance.dispose after bundle shut down
                 Key: FELIX-4287
                 URL: https://issues.apache.org/jira/browse/FELIX-4287
             Project: Felix
          Issue Type: Bug
          Components: Declarative Services (SCR)
    Affects Versions: scr-1.8.0
            Reporter: David Jencks
            Assignee: David Jencks
             Fix For: scr-1.8.0


There are no checks in the call sequence from ComponentInstance.dispose that the component has not already been disposed.  This often causes no problems but if the bundle has been shut down and the ComponentInstance is stale this can cause an NPE such as (thanks to Pierre de Rop):

java.lang.NullPointerException
      at
org.apache.felix.scr.impl.BundleComponentActivator.unregisterComponentId(BundleComponentActivator.java:500)
      at
org.apache.felix.scr.impl.manager.AbstractComponentManager.clear(AbstractComponentManager.java:1157)
      at
org.apache.felix.scr.impl.manager.SingleComponentManager.clear(SingleComponentManager.java:109)
      at
org.apache.felix.scr.impl.manager.AbstractComponentManager.disposeInternal(AbstractComponentManager.java:890)
      at
org.apache.felix.scr.impl.manager.AbstractComponentManager.dispose(AbstractComponentManager.java:576)
      at
org.apache.felix.scr.impl.manager.AbstractComponentManager.dispose(AbstractComponentManager.java:561)
      at
org.apache.felix.scr.impl.manager.ComponentContextImpl$ComponentInstanceImpl.dispose(ComponentContextImpl.java:226)
      at
....

I'm going to eliminate the direct cause of the NPE by not unsetting the field in BCA but also simplify the deactivate/dispose methods to make the control flow clearer and put a disposed check at the top.



--
This message was sent by Atlassian JIRA
(v6.1#6144)