aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2014-06-20 12:02:30 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2014-06-20 12:08:15 +0200
commit7f8e4f2dccbd747d3c5c726ee1d1281fe2a91167 (patch)
treec366ad6faffc2f0c84b9933166da3da143d86002 /sonar-batch
parent4cb80adde707a46e28e2e0d414a19a3790767424 (diff)
downloadsonarqube-7f8e4f2dccbd747d3c5c726ee1d1281fe2a91167.tar.gz
sonarqube-7f8e4f2dccbd747d3c5c726ee1d1281fe2a91167.zip
SONAR-5007 do not generate event on QProfile change on first analysis
Diffstat (limited to 'sonar-batch')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/rule/QProfileEventsDecorator.java16
1 files changed, 8 insertions, 8 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/rule/QProfileEventsDecorator.java b/sonar-batch/src/main/java/org/sonar/batch/rule/QProfileEventsDecorator.java
index 9f05d4e5fa0..eeb1c7fd777 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/rule/QProfileEventsDecorator.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/rule/QProfileEventsDecorator.java
@@ -19,7 +19,6 @@
*/
package org.sonar.batch.rule;
-import com.google.common.collect.Maps;
import org.sonar.api.batch.Decorator;
import org.sonar.api.batch.DecoratorContext;
import org.sonar.api.batch.DependsUpon;
@@ -66,16 +65,17 @@ public class QProfileEventsDecorator implements Decorator {
return;
}
- // Load current profiles
- Measure currentMeasure = context.getMeasure(CoreMetrics.QUALITY_PROFILES);
- Map<String, QProfile> currentProfiles = UsedQProfiles.fromJson(currentMeasure.getData()).profilesByKey();
-
// Load previous profiles
- Map<String, QProfile> previousProfiles = Maps.newHashMap();
Measure previousMeasure = getPreviousMeasure(resource, CoreMetrics.QUALITY_PROFILES);
- if (previousMeasure != null && previousMeasure.getData() != null) {
- previousProfiles = UsedQProfiles.fromJson(previousMeasure.getData()).profilesByKey();
+ if (previousMeasure == null || previousMeasure.getData() == null) {
+ // first analysis -> do not generate events
+ return;
}
+ Map<String, QProfile> previousProfiles = UsedQProfiles.fromJson(previousMeasure.getData()).profilesByKey();
+
+ // Load current profiles
+ Measure currentMeasure = context.getMeasure(CoreMetrics.QUALITY_PROFILES);
+ Map<String, QProfile> currentProfiles = UsedQProfiles.fromJson(currentMeasure.getData()).profilesByKey();
// Detect new profiles or updated profiles
for (QProfile profile : currentProfiles.values()) {