Author: bdelacretaz
Date: Fri Jul 8 09:16:02 2016
New Revision: 1751873
URL: http://svn.apache.org/viewvc?rev=1751873&view=rev
Log:
SLING-5827 - more robust conversion of service properties
Modified:
sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/util/HealthCheckMetadata.java
Modified:
sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/util/HealthCheckMetadata.java
URL:
http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/util/HealthCheckMetadata.java?rev=1751873&r1=1751872&r2=1751873&view=diff
==============================================================================
---
sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/util/HealthCheckMetadata.java
(original)
+++
sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/util/HealthCheckMetadata.java
Fri Jul 8 09:16:02 2016
@@ -22,6 +22,7 @@ import java.util.LinkedList;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
+import org.apache.sling.commons.osgi.PropertiesUtil;
import org.apache.sling.hc.api.HealthCheck;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceReference;
@@ -140,10 +141,10 @@ public class HealthCheckMetadata {
private String getHealthCheckTitle(final ServiceReference ref) {
String name = (String) ref.getProperty(HealthCheck.NAME);
if (StringUtils.isBlank(name)) {
- name = (String) ref.getProperty(Constants.SERVICE_DESCRIPTION);
+ name =
PropertiesUtil.toString(ref.getProperty(Constants.SERVICE_DESCRIPTION), null);
}
if (StringUtils.isBlank(name)) {
- name = (String) ref.getProperty(Constants.SERVICE_PID);
+ name =
PropertiesUtil.toString(ref.getProperty(Constants.SERVICE_PID), null);
}
if (StringUtils.isBlank(name)) {
name = "HealthCheck:" + ref.getProperty(Constants.SERVICE_ID);