aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core
diff options
context:
space:
mode:
Diffstat (limited to 'sonar-core')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/persistence/DefaultDatabase.java18
1 files changed, 2 insertions, 16 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 e6cb4c5e426..063dd30917e 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
@@ -31,11 +31,11 @@ import org.sonar.api.config.Settings;
import org.sonar.api.database.DatabaseProperties;
import org.sonar.core.persistence.dialect.Dialect;
import org.sonar.core.persistence.dialect.DialectUtils;
-import org.sonar.core.persistence.dialect.H2;
import org.sonar.core.persistence.profiling.PersistenceProfiling;
import org.sonar.jpa.session.CustomHibernateConnectionProvider;
import javax.sql.DataSource;
+
import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;
@@ -87,33 +87,19 @@ public class DefaultDatabase implements Database {
@VisibleForTesting
void initSettings() {
- initProperties();
- initDialect();
- }
-
- private void initProperties() {
properties = new Properties();
completeProperties(settings, properties, SONAR_JDBC);
completeProperties(settings, properties, SONAR_HIBERNATE);
completeDefaultProperties(properties);
doCompleteProperties(properties);
- }
- private void initDialect() {
dialect = DialectUtils.find(properties.getProperty(SONAR_JDBC_DIALECT), properties.getProperty(SONAR_JDBC_URL));
if (dialect == null) {
- throw new IllegalStateException("Can not guess the JDBC dialect. Please check the property " + SONAR_JDBC_URL + ".");
+ throw new IllegalStateException(String.format("Can not guess the JDBC dialect. Please check the property %s.", SONAR_JDBC_URL));
}
- checkH2Database();
properties.setProperty(DatabaseProperties.PROP_DRIVER, dialect.getDefaultDriverClassName());
}
- protected void checkH2Database() {
- if (H2.ID.equals(dialect.getId())) {
- LoggerFactory.getLogger(DefaultDatabase.class).warn("H2 database should be used for evaluation purpose only");
- }
- }
-
private void initDatasource() throws Exception {// NOSONAR this exception is thrown by BasicDataSourceFactory
// but it's correctly caught by start()
LOG.info("Create JDBC datasource for " + properties.getProperty(DatabaseProperties.PROP_URL, DEFAULT_URL));