| Summary: | DataSourceTracker is using bundle context of the service provider bundle to get the service | ||
|---|---|---|---|
| Product: | [RT] Gemini.JPA | Reporter: | Sahoo <sanjeeb.sahoo> |
| Component: | Core | Assignee: | Michael Keith <michael.keith> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | 1.0.0 | ||
| Target Milestone: | 1.0.0 M4 | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
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 ;-) |
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().