Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 330769 - DataSourceTracker is using bundle context of the service provider bundle to get the service
Summary: DataSourceTracker is using bundle context of the service provider bundle to g...
Status: RESOLVED FIXED
Alias: None
Product: Gemini.JPA
Classification: RT
Component: Core (show other bugs)
Version: 1.0.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 1.0.0 M4   Edit
Assignee: Michael Keith CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-22 03:12 EST by Sahoo CLA
Modified: 2010-12-03 13:31 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sahoo CLA 2010-11-22 03:12:01 EST
I see the following code in DataSourceTracker.java:
    public Object addingService(ServiceReference ref) {

        return ref.getBundle().getBundleContext().getService(ref);

    }


ServiceReference.getBundle() returns the bundle that registered the service referenced by this service reference. Should the above code not be using its own bundle context instead? So, instead of 
ref.getBundle(), 
use
BundleReference.class.cast(getClass().getClassLoader()).getBundle().
Comment 1 Michael Keith CLA 2010-12-03 12:47:54 EST
The tracker is not used to obtain services - this line was just filled in to return something resembling the service. However, it never hurts to make it correct just in case someone down the road decide they now want to use the tracker to get the service ;-)