4thline/cling — Issue #15: [osgi] Event UNREGISTERING is not fired to ServiceListeners
Author: WydD
Created: 2011-11-09 16:16:37+00:00
State: open

Previously reported here: http://code.google.com/p/bwgz-org/issues/detail?id=1

What steps will reproduce the problem?
1. Launch the basedriver
2. Launch a remote UPnP Device
3. Register a ServiceListener with the right filter in order to see the device
4. Stop the UPnP device

The expected behaviour: An event serviceChanged(ServiceEvent.UNREGISTERING) should be thrown to the ServiceListener which is not happening.

Version: 2.0-SNAPSHOT as of nov.9 2011, on felix.

In org.fourthline.cling.osgi.basedriver.discover.ClingRegistryListener:122, there is context.ungetService(data.getServiceReference());
In order to correctly throw events, it has to call ServiceRegistration.unregister().
I slightly modified UPnPDeviceBinding to keep registration instead of reference and it's working.

Old 1.1 sourcecode is available as an attachment of the original issue, but no changes have been made and is applicable to 2.0.