ReferenceListRecepie releases using the wrong BundleContext
-----------------------------------------------------------

                 Key: ARIES-829
                 URL: https://issues.apache.org/jira/browse/ARIES-829
             Project: Aries
          Issue Type: Bug
          Components: Blueprint
    Affects Versions: blueprint-0.3.1
            Reporter: Alasdair Nottingham
            Assignee: Alasdair Nottingham


Looking at ARIES-828 logs I spotted an IllegalStateException in 
ReferenceListRecipe.ServiceDispatcher.destory on the following line:

ctx.ungetService(ref);

so of course I looked and thought, ah we should just catch the 
IllegalStateException and move on, we get that if the service doesn't exist 
anymore, so who cares. Then I spotted the context. It does this:


                Bundle bundle = ref.getBundle();
                if (bundle != null) {
                    BundleContext ctx = bundle.getBundleContext();
                    if (ctx != null) {
                          ctx.ungetService(ref);
                    }
                }

This means we are using the bundle context of the bundle that registered the 
service to unget it. The code where we do a lookup says this:

getBundleContextForServiceLookup().getService(reference);

which returns in the general case the BundleContext for the BlueprintContainer. 
So we get using the bundle context of the blueprint bundle that uses the 
service, and unget using the bundle context of the bundle providing the 
service. I know I'm having a bad day but my eyes sprung out on stalks when I 
saw this.

--
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

        

Reply via email to