aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2011-11-07 22:58:12 +0100
committersimonbrandhof <simon.brandhof@gmail.com>2011-11-07 22:58:12 +0100
commit2d37e6afa362160ffcdecc31c36855ba4ab060d0 (patch)
tree39732513425582781dda85a695a88c368a74daa8 /sonar-core
parent78bb7e03936055a93419f9284aab475955d46960 (diff)
downloadsonarqube-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.java10
-rw-r--r--sonar-core/src/main/java/org/sonar/jpa/session/DefaultDatabaseConnector.java2
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);
}