From: Fabrice Bellingard Date: Thu, 24 May 2012 08:23:10 +0000 (+0200) Subject: Fix violations X-Git-Tag: 3.1~87 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0f11a1afd7361990b651302c65f58db809ddf5a4;p=sonarqube.git Fix violations --- diff --git a/plugins/sonar-findbugs-plugin/src/test/java/org/sonar/plugins/findbugs/FindbugsExecutorTest.java b/plugins/sonar-findbugs-plugin/src/test/java/org/sonar/plugins/findbugs/FindbugsExecutorTest.java index 4bea359f559..adc231ac529 100644 --- a/plugins/sonar-findbugs-plugin/src/test/java/org/sonar/plugins/findbugs/FindbugsExecutorTest.java +++ b/plugins/sonar-findbugs-plugin/src/test/java/org/sonar/plugins/findbugs/FindbugsExecutorTest.java @@ -19,14 +19,7 @@ */ package org.sonar.plugins.findbugs; -import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertThat; -import static org.junit.internal.matchers.StringContains.containsString; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.io.File; - +import com.google.common.collect.Lists; import org.apache.commons.io.FileUtils; import org.junit.Test; import org.sonar.api.CoreProperties; @@ -34,6 +27,14 @@ import org.sonar.api.resources.Project; import org.sonar.api.resources.ProjectFileSystem; import org.sonar.api.utils.SonarException; +import java.io.File; + +import static org.hamcrest.core.Is.is; +import static org.junit.Assert.assertThat; +import static org.junit.internal.matchers.StringContains.containsString; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + public class FindbugsExecutorTest { @Test @@ -78,6 +79,7 @@ public class FindbugsExecutorTest { when(conf.getFindbugsProject()).thenReturn(project); when(conf.saveExcludeConfigXml()).thenReturn(new File("test-resources/findbugs-exclude.xml")); when(conf.saveIncludeConfigXml()).thenReturn(new File("test-resources/findbugs-include.xml")); + when(conf.getExcludesFilters()).thenReturn(Lists.newArrayList(new File("test-resources/findbugs-exclude.xml"), new File("test-resources/fake-file.xml"))); when(conf.getEffort()).thenReturn("default"); when(conf.getTimeout()).thenReturn(CoreProperties.FINDBUGS_TIMEOUT_DEFAULT_VALUE); return conf; diff --git a/sonar-core/src/main/java/org/sonar/core/review/workflow/WorkflowEngine.java b/sonar-core/src/main/java/org/sonar/core/review/workflow/WorkflowEngine.java index 4c7c17fec17..08261723eed 100644 --- a/sonar-core/src/main/java/org/sonar/core/review/workflow/WorkflowEngine.java +++ b/sonar-core/src/main/java/org/sonar/core/review/workflow/WorkflowEngine.java @@ -29,10 +29,15 @@ import org.sonar.api.ServerComponent; import org.sonar.api.config.Settings; import org.sonar.core.review.workflow.condition.Condition; import org.sonar.core.review.workflow.function.Function; -import org.sonar.core.review.workflow.review.*; +import org.sonar.core.review.workflow.review.DefaultReview; +import org.sonar.core.review.workflow.review.DefaultWorkflowContext; +import org.sonar.core.review.workflow.review.MutableReview; +import org.sonar.core.review.workflow.review.Review; +import org.sonar.core.review.workflow.review.WorkflowContext; import org.sonar.core.review.workflow.screen.Screen; import javax.annotation.Nullable; + import java.util.List; import java.util.Map; @@ -112,13 +117,13 @@ public class WorkflowEngine implements ServerComponent { } private boolean verifyConditionsQuietly(@Nullable Review review, WorkflowContext context, List conditions) { - for (Condition condition : conditions) { - if (!condition.doVerify(review, context)) { - return false; - } + for (Condition condition : conditions) { + if (!condition.doVerify(review, context)) { + return false; } - return true; } + return true; + } private void verifyConditions(@Nullable Review review, WorkflowContext context, List conditions) { for (Condition condition : conditions) { diff --git a/sonar-core/src/main/java/org/sonar/core/review/workflow/review/Comment.java b/sonar-core/src/main/java/org/sonar/core/review/workflow/review/Comment.java index f040d81b722..a3a332eb5a5 100644 --- a/sonar-core/src/main/java/org/sonar/core/review/workflow/review/Comment.java +++ b/sonar-core/src/main/java/org/sonar/core/review/workflow/review/Comment.java @@ -22,7 +22,7 @@ package org.sonar.core.review.workflow.review; import org.apache.commons.lang.builder.ReflectionToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; -public class Comment { +public class Comment implements Cloneable { private String markdownText; private Long userId;