]> source.dussan.org Git - sonarqube.git/commitdiff
Fail server startup if can not connect to DB
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Thu, 25 Sep 2014 16:39:55 +0000 (18:39 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Thu, 25 Sep 2014 16:39:55 +0000 (18:39 +0200)
sonar-core/src/main/java/org/sonar/core/persistence/DefaultDatabase.java

index d8a0dadc24b532ca56e7032be49e188d6b4474b8..50e7a54790af9cf006f920746cfcfc237df8f1d9 100644 (file)
@@ -111,8 +111,8 @@ public class DefaultDatabase implements Database {
     try {
       LOG.debug("Testing JDBC connection");
       connection = datasource.getConnection();
-    } catch (Exception e) {
-      LOG.error("Can not connect to database. Please check connectivity and settings (see the properties prefixed by 'sonar.jdbc.').", e);
+    } catch (SQLException e) {
+      throw new IllegalStateException("Can not connect to database. Please check connectivity and settings (see the properties prefixed by 'sonar.jdbc.').", e);
     } finally {
       DbUtils.closeQuietly(connection);
     }