incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r1599272 - /sling/trunk/contrib/crankstart/core/src/main/java/org/apache/sling/crankstart/core/commands/StartBundles.java
Date Mon, 02 Jun 2014 17:12:05 GMT
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) {



Mime
View raw message