karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject [1/3] karaf git commit: [KARAF-2966] scr:details - Sort the properties so its easier for humans to read
Date Fri, 27 Nov 2015 09:16:54 GMT
Repository: karaf
Updated Branches:
  refs/heads/master 1db79544c -> 6d402cd43


[KARAF-2966] scr:details - Sort the properties so its easier for humans to read


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/34b160da
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/34b160da
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/34b160da

Branch: refs/heads/master
Commit: 34b160daa6d32b812955a84455d800b309572420
Parents: ab8040f
Author: Andrea Cosentino <ancosen@gmail.com>
Authored: Thu Nov 26 17:32:00 2015 +0100
Committer: Andrea Cosentino <ancosen@gmail.com>
Committed: Thu Nov 26 17:32:00 2015 +0100

----------------------------------------------------------------------
 .../apache/karaf/scr/command/action/DetailsAction.java    | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/34b160da/scr/command/src/main/java/org/apache/karaf/scr/command/action/DetailsAction.java
----------------------------------------------------------------------
diff --git a/scr/command/src/main/java/org/apache/karaf/scr/command/action/DetailsAction.java
b/scr/command/src/main/java/org/apache/karaf/scr/command/action/DetailsAction.java
index 0304b00..dcf0076 100644
--- a/scr/command/src/main/java/org/apache/karaf/scr/command/action/DetailsAction.java
+++ b/scr/command/src/main/java/org/apache/karaf/scr/command/action/DetailsAction.java
@@ -32,6 +32,9 @@ import org.osgi.framework.ServiceReference;
 import org.osgi.service.component.ComponentConstants;
 
 import java.util.Hashtable;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.TreeMap;
 
 /**
  * Display the details associated with a given component by supplying its component name.
@@ -57,10 +60,11 @@ public class DetailsAction extends ScrActionSupport {
             printDetail("  State               : ", ScrUtils.getState(component.getState()));
 
             Hashtable props = (Hashtable)component.getProperties();
-            if (!props.isEmpty()) {
+            Map map = new TreeMap(props);
+            if (!map.isEmpty()) {
                 System.out.println(SimpleAnsi.INTENSITY_BOLD + "  Properties          : "
+ SimpleAnsi.INTENSITY_NORMAL);
-                for (Object key : props.keySet()) {
-                    Object value = props.get(key);
+                for (Object key : map.keySet()) {
+                    Object value = map.get(key);
                     printDetail("    ", key + "=" + value);
                 }
             }


Mime
View raw message