From 0d4f47c5831061fe5de4c37fe28a86089f17cab6 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Thu, 25 Sep 2014 18:39:55 +0200 Subject: [PATCH] Fail server startup if can not connect to DB --- .../main/java/org/sonar/core/persistence/DefaultDatabase.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/DefaultDatabase.java b/sonar-core/src/main/java/org/sonar/core/persistence/DefaultDatabase.java index d8a0dadc24b..50e7a54790a 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/DefaultDatabase.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/DefaultDatabase.java @@ -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); } -- 2.39.5