diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2014-07-29 00:00:04 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2014-07-29 00:00:04 +0200 |
commit | 5af0e0779610017b6056b63278e1a16c6d49d25b (patch) | |
tree | 8908d360e2155f8145605d05d700cb1fac3a05a1 /sonar-core | |
parent | 4bee8f9892ddda7497187edc97c08d1935069a98 (diff) | |
download | sonarqube-5af0e0779610017b6056b63278e1a16c6d49d25b.tar.gz sonarqube-5af0e0779610017b6056b63278e1a16c6d49d25b.zip |
SONAR-5487 Check minimal required version of Oracle JDBC driver (11.2)
Diffstat (limited to 'sonar-core')
-rw-r--r-- | sonar-core/src/main/java/org/sonar/core/persistence/DefaultDatabase.java | 18 |
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)); |