You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by gn...@apache.org on 2014/04/29 01:34:01 UTC

[5/7] git commit: Simplify code a bit

Simplify code a bit

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

Branch: refs/heads/master
Commit: 24c00ae056e40cba45c46d7b634ca19f5e727a07
Parents: b6c5a17
Author: Guillaume Nodet <gn...@gmail.com>
Authored: Tue Apr 29 01:14:39 2014 +0200
Committer: Guillaume Nodet <gn...@gmail.com>
Committed: Tue Apr 29 01:14:39 2014 +0200

----------------------------------------------------------------------
 .../org/apache/karaf/scr/command/action/ListAction.java  | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/24c00ae0/scr/command/src/main/java/org/apache/karaf/scr/command/action/ListAction.java
----------------------------------------------------------------------
diff --git a/scr/command/src/main/java/org/apache/karaf/scr/command/action/ListAction.java b/scr/command/src/main/java/org/apache/karaf/scr/command/action/ListAction.java
index ce47532..50d2e93 100755
--- a/scr/command/src/main/java/org/apache/karaf/scr/command/action/ListAction.java
+++ b/scr/command/src/main/java/org/apache/karaf/scr/command/action/ListAction.java
@@ -46,16 +46,9 @@ public class ListAction extends ScrActionSupport {
         Component[] components = scrService.getComponents();
         Arrays.sort(components, idComparator);
         for (Component component : ScrUtils.emptyIfNull(Component.class, components)) {
-            if (showHidden) {
-                // we display all because we are overridden
+            // Display only non hidden components, or all if showHidden is true
+            if (showHidden || !ScrActionSupport.isHiddenComponent(component)) {
                 table.addRow().addContent(component.getId(), ScrUtils.getState(component.getState()), component.getName());
-            } else {
-                if (ScrActionSupport.isHiddenComponent(component)) {
-                    // do nothing
-                } else {
-                    // we aren't hidden so print it
-                    table.addRow().addContent(component.getId(), ScrUtils.getState(component.getState()), component.getName());
-                }
             }
         }
         table.print(System.out);