mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-10 13:21:53 +01:00
handle arrays for pids (#557)
Signed-off-by: Kai Kreuzer <kai@openhab.org>
This commit is contained in:
parent
c5047f23af
commit
e96aa523fc
@ -310,10 +310,16 @@ public class ConfigurableServiceResource implements RESTResource {
|
||||
private String getServiceId(ServiceReference<?> serviceReference) {
|
||||
Object pid = serviceReference.getProperty(Constants.SERVICE_PID);
|
||||
if (pid != null) {
|
||||
return (String) pid;
|
||||
} else {
|
||||
return (String) serviceReference.getProperty(ComponentConstants.COMPONENT_NAME);
|
||||
if (pid instanceof String) {
|
||||
return (String) pid;
|
||||
} else {
|
||||
String[] pidArray = (String[]) pid;
|
||||
if (pidArray.length > 0) {
|
||||
return pidArray[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
return (String) serviceReference.getProperty(ComponentConstants.COMPONENT_NAME);
|
||||
}
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.OPTIONAL, policy = ReferencePolicy.DYNAMIC)
|
||||
|
Loading…
Reference in New Issue
Block a user