diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2011-11-07 22:58:12 +0100 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2011-11-07 22:58:12 +0100 |
commit | 2d37e6afa362160ffcdecc31c36855ba4ab060d0 (patch) | |
tree | 39732513425582781dda85a695a88c368a74daa8 /sonar-core | |
parent | 78bb7e03936055a93419f9284aab475955d46960 (diff) | |
download | sonarqube-2d37e6afa362160ffcdecc31c36855ba4ab060d0.tar.gz sonarqube-2d37e6afa362160ffcdecc31c36855ba4ab060d0.zip |
fix violations
Diffstat (limited to 'sonar-core')
-rw-r--r-- | sonar-core/src/main/java/org/sonar/jpa/session/CustomHibernateConnectionProvider.java | 10 | ||||
-rw-r--r-- | sonar-core/src/main/java/org/sonar/jpa/session/DefaultDatabaseConnector.java | 2 |
2 files changed, 8 insertions, 4 deletions
diff --git a/sonar-core/src/main/java/org/sonar/jpa/session/CustomHibernateConnectionProvider.java b/sonar-core/src/main/java/org/sonar/jpa/session/CustomHibernateConnectionProvider.java index 5f8490a3858..e6e36cc1587 100644 --- a/sonar-core/src/main/java/org/sonar/jpa/session/CustomHibernateConnectionProvider.java +++ b/sonar-core/src/main/java/org/sonar/jpa/session/CustomHibernateConnectionProvider.java @@ -26,11 +26,15 @@ import java.util.Properties; public class CustomHibernateConnectionProvider extends InjectedDataSourceConnectionProvider { - static DataSource datasource; - + private static DataSource datasourceForConfig; + + static void setDatasourceForConfig(DataSource ds) { + CustomHibernateConnectionProvider.datasourceForConfig = ds; + } + @Override public void configure(Properties props) { - setDataSource(datasource); + setDataSource(datasourceForConfig); super.configure(props); } } diff --git a/sonar-core/src/main/java/org/sonar/jpa/session/DefaultDatabaseConnector.java b/sonar-core/src/main/java/org/sonar/jpa/session/DefaultDatabaseConnector.java index cf1e4b83210..b1bed908691 100644 --- a/sonar-core/src/main/java/org/sonar/jpa/session/DefaultDatabaseConnector.java +++ b/sonar-core/src/main/java/org/sonar/jpa/session/DefaultDatabaseConnector.java @@ -54,7 +54,7 @@ public class DefaultDatabaseConnector extends AbstractDatabaseConnector { private void createDatasource() { try { - CustomHibernateConnectionProvider.datasource = database.getDataSource(); + CustomHibernateConnectionProvider.setDatasourceForConfig(database.getDataSource()); } catch (Exception e) { throw new SonarException("Fail to connect to database", e); } |