You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Felix Meschberger (Commented) (JIRA)" <ji...@apache.org> on 2012/02/01 08:34:58 UTC

[jira] [Commented] (FELIX-3334) PreferencesManager can throw NPE after being stopped.

    [ https://issues.apache.org/jira/browse/FELIX-3334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13197641#comment-13197641 ] 

Felix Meschberger commented on FELIX-3334:
------------------------------------------

A bundle being stopped is automatically unregistered as a bundle listener but only after having called the stop method of the BundleActivator.

Looking at the code, chances are minimal (if there is a concurrency between event handling and handling stop), but this would not be 100% solved by the patch (because an event might still be coming in.

A better fix would be to check for the null-situation in the event handler when accessing the store.

Did you actually encounter an NPE ?
                
> PreferencesManager can throw NPE after being stopped.
> -----------------------------------------------------
>
>                 Key: FELIX-3334
>                 URL: https://issues.apache.org/jira/browse/FELIX-3334
>             Project: Felix
>          Issue Type: Bug
>          Components: Preferences Service
>    Affects Versions: prefs-1.0.4
>            Reporter: J.W. Janssen
>              Labels: patch
>         Attachments: quickfix.patch
>
>
> PreferencesManager#bundleChanged tries to intercept bundles that are uninstalled. However, if the PreferencesManager itself is stopped, it does not unregister itself as bundle listener, causing possible NPEs when other bundles depending on the preferences service are stopped later on, for example during a shutdown.
> I've got a patch available, will attach it to this issue to be applied.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira