You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/10/18 23:20:09 UTC

[sling-org-apache-sling-hc-api] 07/08: SLING-6855 - accept String as well for WARNINGS_STICK_FOR_MINUTES (could do the same for other values but lets minimize changes)

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-api.git

commit c13813ead0cfe20ab1f704a43dc465d92bc0902d
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Fri Jun 9 13:52:59 2017 +0000

    SLING-6855 - accept String as well for WARNINGS_STICK_FOR_MINUTES (could do the same for other values but lets minimize changes)
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1798218 13f79535-47bb-0310-9956-ffa450edef68
---
 .../java/org/apache/sling/hc/util/HealthCheckMetadata.java   | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/hc/util/HealthCheckMetadata.java b/src/main/java/org/apache/sling/hc/util/HealthCheckMetadata.java
index b59eb0a..f996652 100644
--- a/src/main/java/org/apache/sling/hc/util/HealthCheckMetadata.java
+++ b/src/main/java/org/apache/sling/hc/util/HealthCheckMetadata.java
@@ -59,10 +59,20 @@ public class HealthCheckMetadata {
         this.tags = arrayPropertyToListOfStr(ref.getProperty(HealthCheck.TAGS));
         this.asyncCronExpression = (String) ref.getProperty(HealthCheck.ASYNC_CRON_EXPRESSION);
         this.resultCacheTtlInMs = (Long)ref.getProperty(HealthCheck.RESULT_CACHE_TTL_IN_MS);
-        this.warningsStickForMinutes = (Long) ref.getProperty(HealthCheck.WARNINGS_STICK_FOR_MINUTES);
+        this.warningsStickForMinutes = toLong(ref.getProperty(HealthCheck.WARNINGS_STICK_FOR_MINUTES));
         this.serviceReference = ref;
     }
 
+    private Long toLong(Object configValue) {
+        if(configValue == null) {
+            return null;
+        }
+        if(configValue instanceof Long) {
+            return (Long)configValue;
+        }
+        return Long.valueOf(configValue.toString());
+    }
+    
     /**
      * The name of the health check as defined through the {@link HealthCheck#NAME}
      * property.

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.