From 2d37e6afa362160ffcdecc31c36855ba4ab060d0 Mon Sep 17 00:00:00 2001 From: simonbrandhof Date: Mon, 7 Nov 2011 22:58:12 +0100 Subject: fix violations --- .../src/main/java/org/sonar/plugins/pmd/xml/PmdRule.java | 2 +- .../sonar/jpa/session/CustomHibernateConnectionProvider.java | 10 +++++++--- .../java/org/sonar/jpa/session/DefaultDatabaseConnector.java | 2 +- sonar-graph/src/main/java/org/sonar/graph/FeedbackCycle.java | 5 ++++- .../src/main/java/org/sonar/api/measures/RuleMeasure.java | 6 +++++- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/xml/PmdRule.java b/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/xml/PmdRule.java index 7cc292162ce..0df8d6f1a2d 100644 --- a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/xml/PmdRule.java +++ b/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/xml/PmdRule.java @@ -22,7 +22,7 @@ package org.sonar.plugins.pmd.xml; import java.util.ArrayList; import java.util.List; -public class PmdRule implements Comparable { +public class PmdRule { private String ref; 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); } diff --git a/sonar-graph/src/main/java/org/sonar/graph/FeedbackCycle.java b/sonar-graph/src/main/java/org/sonar/graph/FeedbackCycle.java index a23cb74c9f0..5c202597db6 100644 --- a/sonar-graph/src/main/java/org/sonar/graph/FeedbackCycle.java +++ b/sonar-graph/src/main/java/org/sonar/graph/FeedbackCycle.java @@ -29,6 +29,9 @@ import java.util.Set; import com.google.common.collect.HashMultiset; import com.google.common.collect.Multiset; +/** + * Note: this class has a natural ordering that is inconsistent with equals + */ public final class FeedbackCycle implements Iterable, Comparable { private List orderedFeedbackEdges; @@ -89,7 +92,7 @@ public final class FeedbackCycle implements Iterable, Comparable