aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@gmail.com>2013-05-30 11:44:22 +0200
committerJulien Lancelot <julien.lancelot@gmail.com>2013-05-30 11:44:22 +0200
commit254ecf6ea64ef887eacde7ed181305e2481b4b7e (patch)
treeb9b406d126cc6b109f257c4c404593ea7ba27967 /sonar-core
parent12577baece9283bed5d4240ac7321804929fdeb7 (diff)
downloadsonarqube-254ecf6ea64ef887eacde7ed181305e2481b4b7e.tar.gz
sonarqube-254ecf6ea64ef887eacde7ed181305e2481b4b7e.zip
Fix quality flaws
Diffstat (limited to 'sonar-core')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/issue/ActionPlanDeadlineComparator.java3
-rw-r--r--sonar-core/src/main/java/org/sonar/core/issue/DefaultIssueBuilder.java4
-rw-r--r--sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java7
-rw-r--r--sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueBuilderTest.java2
4 files changed, 11 insertions, 5 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/issue/ActionPlanDeadlineComparator.java b/sonar-core/src/main/java/org/sonar/core/issue/ActionPlanDeadlineComparator.java
index 0deb1837dbf..6078aaed3d7 100644
--- a/sonar-core/src/main/java/org/sonar/core/issue/ActionPlanDeadlineComparator.java
+++ b/sonar-core/src/main/java/org/sonar/core/issue/ActionPlanDeadlineComparator.java
@@ -21,6 +21,7 @@ package org.sonar.core.issue;
import org.sonar.api.issue.ActionPlan;
+import java.io.Serializable;
import java.util.Comparator;
import java.util.Date;
@@ -28,7 +29,7 @@ import java.util.Date;
* Sort action plans by chronological deadlines. Plans without deadline are
* located after plans with deadline.
*/
-public class ActionPlanDeadlineComparator implements Comparator<ActionPlan> {
+public class ActionPlanDeadlineComparator implements Comparator<ActionPlan>, Serializable {
@Override
public int compare(ActionPlan a1, ActionPlan a2) {
diff --git a/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssueBuilder.java b/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssueBuilder.java
index e187b923dd2..1c4dcf208fb 100644
--- a/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssueBuilder.java
+++ b/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssueBuilder.java
@@ -27,6 +27,7 @@ import org.sonar.api.issue.Issue;
import org.sonar.api.rule.RuleKey;
import javax.annotation.Nullable;
+
import java.util.Map;
import java.util.UUID;
@@ -104,8 +105,7 @@ public class DefaultIssueBuilder implements Issuable.IssueBuilder {
@Override
public DefaultIssue build() {
Preconditions.checkNotNull(componentKey, "Component key must be set");
- // TODO
- //Preconditions.checkNotNull(projectKey, "Project key must be set");
+ Preconditions.checkNotNull(projectKey, "Project key must be set");
Preconditions.checkNotNull(ruleKey, "Rule key must be set");
DefaultIssue issue = new DefaultIssue();
diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java b/sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java
index af3619bd53c..a1660f4a28e 100644
--- a/sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java
+++ b/sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java
@@ -120,12 +120,15 @@ public class MyBatis implements BatchComponent, ServerComponent {
loadAlias(conf, "ActionPlanStats", ActionPlanStatsDto.class);
Class<?>[] mappers = {ActiveDashboardMapper.class, AuthorMapper.class, DashboardMapper.class,
- DependencyMapper.class, DuplicationMapper.class, GraphDtoMapper.class, IssueMapper.class, IssueStatsMapper.class, IssueChangeMapper.class, LoadedTemplateMapper.class,
- MeasureFilterMapper.class, PropertiesMapper.class, PurgeMapper.class, ResourceKeyUpdaterMapper.class, ResourceIndexerMapper.class, ResourceMapper.class,
+ DependencyMapper.class, DuplicationMapper.class, GraphDtoMapper.class,
+ // ResourceMapper has to be loaded before IssueMapper because this last one used it
+ ResourceMapper.class, IssueMapper.class, IssueStatsMapper.class, IssueChangeMapper.class,
+ LoadedTemplateMapper.class, MeasureFilterMapper.class, PropertiesMapper.class, PurgeMapper.class, ResourceKeyUpdaterMapper.class, ResourceIndexerMapper.class,
ResourceSnapshotMapper.class, RoleMapper.class, RuleMapper.class, SchemaMigrationMapper.class,
SemaphoreMapper.class, UserMapper.class, WidgetMapper.class, WidgetPropertyMapper.class, MeasureMapper.class, SnapshotDataMapper.class,
SnapshotSourceMapper.class, ActionPlanMapper.class, ActionPlanStatsMapper.class
};
+ // AuthorizationMapper has to be loaded before IssueMapper because this last one used it
loadMapper(conf, "org.sonar.core.user.AuthorizationMapper");
loadMappers(conf, mappers);
configureLogback(mappers);
diff --git a/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueBuilderTest.java b/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueBuilderTest.java
index eb55c784461..61d3db092f9 100644
--- a/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueBuilderTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueBuilderTest.java
@@ -33,6 +33,7 @@ public class DefaultIssueBuilderTest {
String componentKey = "org.apache.struts:struts-core:Action.java";
DefaultIssue issue = (DefaultIssue) new DefaultIssueBuilder()
.componentKey(componentKey)
+ .projectKey("org.apache.struts:struts-parent")
.message("the message")
.line(123)
.effortToFix(10000.0)
@@ -64,6 +65,7 @@ public class DefaultIssueBuilderTest {
public void should_not_set_default_severity() {
DefaultIssue issue = (DefaultIssue) new DefaultIssueBuilder()
.componentKey("Action.java")
+ .projectKey("org.apache.struts:struts-parent")
.ruleKey(RuleKey.of("squid", "NullDereference"))
.build();