You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ss...@apache.org on 2019/01/25 13:04:07 UTC
[sling-org-apache-sling-caconfig-impl] branch master updated:
SLING-8240 CAConfig Console Inventory Printer: Fix display problem when
service ranking is not a number
This is an automated email from the ASF dual-hosted git repository.
sseifert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-caconfig-impl.git
The following commit(s) were added to refs/heads/master by this push:
new bed94d9 SLING-8240 CAConfig Console Inventory Printer: Fix display problem when service ranking is not a number
bed94d9 is described below
commit bed94d964adc62f3094f01adba0425442e7ee262
Author: sseifert <ss...@pro-vision.de>
AuthorDate: Fri Jan 25 14:03:55 2019 +0100
SLING-8240 CAConfig Console Inventory Printer: Fix display problem when service ranking is not a number
---
.../management/impl/console/CAConfigInventoryPrinter.java | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/sling/caconfig/management/impl/console/CAConfigInventoryPrinter.java b/src/main/java/org/apache/sling/caconfig/management/impl/console/CAConfigInventoryPrinter.java
index 2074e57..d477b2b 100644
--- a/src/main/java/org/apache/sling/caconfig/management/impl/console/CAConfigInventoryPrinter.java
+++ b/src/main/java/org/apache/sling/caconfig/management/impl/console/CAConfigInventoryPrinter.java
@@ -27,6 +27,7 @@ import java.util.TreeMap;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.math.NumberUtils;
import org.apache.felix.inventory.Format;
import org.apache.felix.inventory.InventoryPrinter;
import org.apache.sling.caconfig.resource.spi.CollectionInheritanceDecider;
@@ -141,12 +142,17 @@ public class CAConfigInventoryPrinter implements InventoryPrinter {
}
private <T> int getServiceRanking(ServiceReference<T> serviceReference) {
- Integer serviceRanking = (Integer)serviceReference.getProperty(Constants.SERVICE_RANKING);
+ Object serviceRanking = serviceReference.getProperty(Constants.SERVICE_RANKING);
if (serviceRanking == null) {
return 0;
}
else {
- return serviceRanking;
+ if (serviceRanking instanceof Number) {
+ return ((Number)serviceRanking).intValue();
+ }
+ else {
+ return NumberUtils.toInt(serviceRanking.toString(), 0);
+ }
}
}