You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2014/06/02 19:12:05 UTC

svn commit: r1599272 - /sling/trunk/contrib/crankstart/core/src/main/java/org/apache/sling/crankstart/core/commands/StartBundles.java

Author: bdelacretaz
Date: Mon Jun  2 17:12:05 2014
New Revision: 1599272

URL: http://svn.apache.org/r1599272
Log:
Log warning for bundle start errors, instead of completely failing

Modified:
    sling/trunk/contrib/crankstart/core/src/main/java/org/apache/sling/crankstart/core/commands/StartBundles.java

Modified: sling/trunk/contrib/crankstart/core/src/main/java/org/apache/sling/crankstart/core/commands/StartBundles.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/crankstart/core/src/main/java/org/apache/sling/crankstart/core/commands/StartBundles.java?rev=1599272&r1=1599271&r2=1599272&view=diff
==============================================================================
--- sling/trunk/contrib/crankstart/core/src/main/java/org/apache/sling/crankstart/core/commands/StartBundles.java (original)
+++ sling/trunk/contrib/crankstart/core/src/main/java/org/apache/sling/crankstart/core/commands/StartBundles.java Mon Jun  2 17:12:05 2014
@@ -40,6 +40,7 @@ public class StartBundles implements Cra
     @Override
     public void execute(CrankstartContext crankstartContext, CrankstartCommandLine commandLine) throws Exception {
         int count = 0;
+        int failures = 0;
         for (Bundle bundle : crankstartContext.getOsgiFramework().getBundleContext().getBundles()) {
             if(isFragment(bundle)) {
                 log.debug("Ignoring fragment bundle {}", bundle.getSymbolicName());
@@ -47,14 +48,19 @@ public class StartBundles implements Cra
             }
             if(bundle.getState() != Bundle.ACTIVE) {
                 log.info("Starting bundle {}", bundle.getSymbolicName());
-                bundle.start();
-                count++;
+                try {
+                    bundle.start();
+                    count++;
+                } catch(Exception e) {
+                    log.warn("Failed to start bundle {}", bundle.getSymbolicName(), e);
+                    failures++;
+                }
             } else {
                 log.debug("Bundle {} is already active", bundle.getSymbolicName());
             }
         }
         
-        log.info("{} bundles started", count);
+        log.info("{} bundles started, {} failures", count, failures);
     }
     
     private boolean isFragment(Bundle b) {