You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Carsten Ziegeler (JIRA)" <ji...@apache.org> on 2018/10/18 05:30:00 UTC

[jira] [Issue Comment Deleted] (FELIX-5950) NPE in MultiplePrototypeRefPair.unsetServiceObject

     [ https://issues.apache.org/jira/browse/FELIX-5950?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carsten Ziegeler updated FELIX-5950:
------------------------------------
    Comment: was deleted

(was: Looking at the code and the DS spec, it seems that MultiplePrototypeRefPair is not really needed. A component should always get the same prototype instance for any reference to that service. As the ref pair objects are per component, the key used for the map (ComponentContextImpl) is always the same single key.
)

> NPE in  MultiplePrototypeRefPair.unsetServiceObject
> ---------------------------------------------------
>
>                 Key: FELIX-5950
>                 URL: https://issues.apache.org/jira/browse/FELIX-5950
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>         Environment: Mac OS X 10.14
>            Reporter: Olivier Prouvost
>            Assignee: Carsten Ziegeler
>            Priority: Major
>             Fix For: scr-2.1.14
>
>
> I use Felix with the eclipse runtime (Photon 0918), and I get a NPE when running my application. 
>  
> Actually in the code of 
> MultiplePrototypeRefPair.unsetServiceObject we have :  instances.get(key). 
> If we search for the callers, the DependencyManager class call It like this : 
>  
>        protected void ungetService(RefPair<S, T> ref)
>         {
>             Object service = ref.unsetServiceObject(*null*);
>             if (service != null)
>  
> Unfortunately, the instances map is a ConcurentHashMap which can not deal with null keys (it calls key.hashcode at the beginning), and this call will always raise an exception... 
> Don't know what is the Felix version involved, but the bundle I use in my launch configuration is  (org.apache.felix.scr 2.0.14.v20180117)
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)