aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/sonar-core-plugin/src
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2011-01-12 15:03:23 +0100
committersimonbrandhof <simon.brandhof@gmail.com>2011-01-12 15:03:23 +0100
commitf42b25885bc505e7ae8645131e88dc66a5ffb0be (patch)
treeaed6bd8a217636bcc73a24c12593f8aac3decfba /plugins/sonar-core-plugin/src
parent7e39a6aecad4b3f0709a308a335d3565c490ab07 (diff)
downloadsonarqube-f42b25885bc505e7ae8645131e88dc66a5ffb0be.tar.gz
sonarqube-f42b25885bc505e7ae8645131e88dc66a5ffb0be.zip
merge 2.5-RC2: fix random execution of NewViolationsDecorator
Diffstat (limited to 'plugins/sonar-core-plugin/src')
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/NewViolationsDecorator.java3
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecorator.java30
2 files changed, 26 insertions, 7 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/NewViolationsDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/NewViolationsDecorator.java
index ec470304406..1f7d5e5982f 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/NewViolationsDecorator.java
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/NewViolationsDecorator.java
@@ -36,7 +36,8 @@ import org.sonar.batch.components.TimeMachineConfiguration;
import java.util.*;
-@DependsUpon(classes = ViolationPersisterDecorator.class)
+/* temporary workaround - the attributes classes() should be used but it is buggy */
+@DependsUpon("ViolationPersisterDecorator")
public class NewViolationsDecorator implements Decorator {
private TimeMachineConfiguration timeMachineConfiguration;
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecorator.java
index 6f2df32db49..28b33e281bd 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecorator.java
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecorator.java
@@ -1,3 +1,22 @@
+/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2009 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * Sonar is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * Sonar is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Sonar; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+ */
package org.sonar.plugins.core.timemachine;
import com.google.common.collect.LinkedHashMultimap;
@@ -8,10 +27,7 @@ import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils;
import org.codehaus.plexus.util.StringInputStream;
-import org.sonar.api.batch.Decorator;
-import org.sonar.api.batch.DecoratorBarriers;
-import org.sonar.api.batch.DecoratorContext;
-import org.sonar.api.batch.DependsUpon;
+import org.sonar.api.batch.*;
import org.sonar.api.database.model.RuleFailureModel;
import org.sonar.api.database.model.SnapshotSource;
import org.sonar.api.resources.Project;
@@ -29,6 +45,8 @@ import java.util.Collections;
import java.util.List;
@DependsUpon(DecoratorBarriers.END_OF_VIOLATIONS_GENERATION)
+@DependedUpon("ViolationPersisterDecorator")
+/* temporary workaround - see NewViolationsDecorator */
public class ViolationPersisterDecorator implements Decorator {
/**
@@ -101,7 +119,7 @@ public class ViolationPersisterDecorator implements Decorator {
}
} catch (IOException e) {
throw new SonarException("Unable to calculate checksums", e);
-
+
} finally {
IOUtils.closeQuietly(stream);
}
@@ -128,7 +146,7 @@ public class ViolationPersisterDecorator implements Decorator {
*/
RuleFailureModel selectPastViolation(Violation violation, Multimap<Rule, RuleFailureModel> pastViolationsByRule) {
Collection<RuleFailureModel> pastViolations = pastViolationsByRule.get(violation.getRule());
- if (pastViolations==null || pastViolations.isEmpty()) {
+ if (pastViolations == null || pastViolations.isEmpty()) {
// skip violation, if there is no past violations with same rule
return null;
}