]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-4898 - Fixed rogue TC when SQ plateform fails to load.
authorStephane Gamard <stephane.gamard@searchbox.com>
Tue, 29 Jul 2014 08:12:08 +0000 (10:12 +0200)
committerStephane Gamard <stephane.gamard@searchbox.com>
Tue, 29 Jul 2014 08:12:08 +0000 (10:12 +0200)
server/sonar-server/src/main/java/org/sonar/server/app/EmbeddedTomcat.java
server/sonar-server/src/main/java/org/sonar/server/platform/PlatformServletContextListener.java

index 50239fe282df34e044914d4f8cc0bda348b8d17a..80f444dd6deafab1424888ac7f8b5d9c8ac8ce2c 100644 (file)
@@ -70,9 +70,10 @@ class EmbeddedTomcat {
       tomcat.getServer().await();
     } catch (Exception e) {
       throw new IllegalStateException("Fail to start web server", e);
+    } finally {
+      // Shutdown command received
+      stop();
     }
-    // Shutdown command received
-    stop();
   }
 
   private File tomcatBasedir() {
@@ -120,7 +121,7 @@ class EmbeddedTomcat {
   }
 
   boolean isReady() {
-    return ready;
+    return ready && tomcat != null;
   }
 
   int port() {
index 0c615c531cbd6e554375e8338048d4fa83c5f3fd..c6b7d2f6346e487d92edf31bfb4a86fb87bd9412 100644 (file)
@@ -49,7 +49,7 @@ public final class PlatformServletContextListener implements ServletContextListe
       // unexpected errors
       LoggerFactory.getLogger(getClass()).error("Fail to start server", t);
       stopQuietly();
-      System.exit(1);
+      throw new IllegalStateException("Fail to start server", t);
     }
   }