Repository: karaf
Updated Branches:
  refs/heads/master b6f472115 -> 26b4ec6dc


Avoid “, ” prefix in the output message when installing multiple bundles


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

Branch: refs/heads/master
Commit: 26b4ec6dc71ac189212c82d9a402ebafafb8955d
Parents: 0780f55
Author: Guillaume Nodet <[email protected]>
Authored: Fri Feb 19 12:03:38 2016 +0100
Committer: Guillaume Nodet <[email protected]>
Committed: Fri Feb 19 12:11:12 2016 +0100

----------------------------------------------------------------------
 .../java/org/apache/karaf/bundle/command/Install.java  | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/26b4ec6d/bundle/core/src/main/java/org/apache/karaf/bundle/command/Install.java
----------------------------------------------------------------------
diff --git 
a/bundle/core/src/main/java/org/apache/karaf/bundle/command/Install.java 
b/bundle/core/src/main/java/org/apache/karaf/bundle/command/Install.java
index cdf2691..63fdb0a 100644
--- a/bundle/core/src/main/java/org/apache/karaf/bundle/command/Install.java
+++ b/bundle/core/src/main/java/org/apache/karaf/bundle/command/Install.java
@@ -19,6 +19,7 @@ package org.apache.karaf.bundle.command;
 import java.net.URI;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.stream.Collectors;
 
 import org.apache.karaf.bundle.core.BundleService;
 import org.apache.karaf.shell.api.action.Action;
@@ -104,14 +105,10 @@ public class Install implements Action {
         if (bundles.size() == 1) {
             System.out.println("Bundle ID: " + bundles.get(0).getBundleId());
         } else {
-            StringBuffer sb = new StringBuffer("Bundle IDs: ");
-            for (Bundle bundle : bundles) {
-                if (sb.length() > 0) {
-                    sb.append(", ");
-                }
-                sb.append(bundle.getBundleId());
-            }
-            System.out.println(sb);
+            String msg = bundles.stream()
+                    .map(b -> Long.toString(b.getBundleId()))
+                    .collect(Collectors.joining(", ", "Bundle IDs: ", ""));
+            System.out.println(msg);
         }
         MultiException.throwIf("Error installing bundles", exceptions);
         return null;

Reply via email to