]> source.dussan.org Git - sonarqube.git/commitdiff
merge 2.5-RC2: fix random execution of NewViolationsDecorator
authorsimonbrandhof <simon.brandhof@gmail.com>
Wed, 12 Jan 2011 14:03:23 +0000 (15:03 +0100)
committersimonbrandhof <simon.brandhof@gmail.com>
Wed, 12 Jan 2011 14:03:23 +0000 (15:03 +0100)
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/NewViolationsDecorator.java
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecorator.java

index ec470304406e67d03a883dd5c3090ceac7a8d590..1f7d5e5982fa97ee7aefb22a15bc8488806178fa 100644 (file)
@@ -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;
index 6f2df32db492dba3809e87b7cbcaab1ed550770c..28b33e281bd45e0066a81f970d640d6d25aeb6cb 100644 (file)
@@ -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;
     }