aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch/src/main/java/org
diff options
context:
space:
mode:
authorJenkins CI <ci@sonarsource.com>2015-12-09 17:31:06 +0100
committerJenkins CI <ci@sonarsource.com>2015-12-09 17:31:06 +0100
commit0102d8108a6b40e3876ace01f1df0afbdeb37ddc (patch)
tree65eff5d83243d57292d1614b37f00ff975914543 /sonar-batch/src/main/java/org
parent1342b253edd4d79be057ceb8905b0919525d140f (diff)
parenta749013e0af281ac0eb19f35fe9f282f3bc80121 (diff)
downloadsonarqube-0102d8108a6b40e3876ace01f1df0afbdeb37ddc.tar.gz
sonarqube-0102d8108a6b40e3876ace01f1df0afbdeb37ddc.zip
Automatic merge from branch-5.3
* origin/branch-5.3: hide number of failing tasks on then project level page SONAR-6887 Improve message when missing revision or date on blame SONAR-6900 Add IT to simulate a build breaker strategy increase contract of leak period background improve display of leak period caption add tooltips for ncloc distribution chart love ie11 improve scales of the bubble chart on the overview page fix tooltips on the overview treemap filter out empty components on the overview treemap normalize overview pages urls and titles improve code quality
Diffstat (limited to 'sonar-batch/src/main/java/org')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scm/DefaultBlameOutput.java16
1 files changed, 9 insertions, 7 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scm/DefaultBlameOutput.java b/sonar-batch/src/main/java/org/sonar/batch/scm/DefaultBlameOutput.java
index 24e1783e97b..00a4029330f 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scm/DefaultBlameOutput.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scm/DefaultBlameOutput.java
@@ -70,10 +70,10 @@ class DefaultBlameOutput implements BlameOutput {
public synchronized void blameResult(InputFile file, List<BlameLine> lines) {
Preconditions.checkNotNull(file);
Preconditions.checkNotNull(lines);
- Preconditions.checkArgument(allFilesToBlame.contains(file), "It was not expected to blame file " + file.relativePath());
+ Preconditions.checkArgument(allFilesToBlame.contains(file), "It was not expected to blame file %s", file.relativePath());
if (lines.size() != file.lines()) {
- LOG.debug("Ignoring blame result since provider returned " + lines.size() + " blame lines but file " + file.relativePath() + " has " + file.lines() + " lines");
+ LOG.debug("Ignoring blame result since provider returned {} blame lines but file {} has {} lines", lines.size(), file.relativePath(), file.lines());
return;
}
@@ -82,8 +82,9 @@ class DefaultBlameOutput implements BlameOutput {
scmBuilder.setComponentRef(batchComponent.batchId());
Map<String, Integer> changesetsIdByRevision = new HashMap<>();
+ int lineId = 1;
for (BlameLine line : lines) {
- validateLine(line);
+ validateLine(line, lineId, file);
Integer changesetId = changesetsIdByRevision.get(line.revision());
if (changesetId == null) {
addChangeset(scmBuilder, line);
@@ -91,6 +92,7 @@ class DefaultBlameOutput implements BlameOutput {
changesetsIdByRevision.put(line.revision(), changesetId);
}
scmBuilder.addChangesetIndexByLine(changesetId);
+ lineId++;
}
writer.writeComponentChangesets(scmBuilder.build());
allFilesToBlame.remove(file);
@@ -98,9 +100,9 @@ class DefaultBlameOutput implements BlameOutput {
progressReport.message(count + "/" + total + " files analyzed");
}
- private static void validateLine(BlameLine line) {
- Preconditions.checkNotNull(line.revision(), "Blame revision cannot be null");
- Preconditions.checkNotNull(line.date(), "Blame date cannot be null");
+ private static void validateLine(BlameLine line, int lineId, InputFile file) {
+ Preconditions.checkArgument(StringUtils.isNotBlank(line.revision()), "Blame revision is blank for file %s at line %s", file.relativePath(), lineId);
+ Preconditions.checkArgument(line.date() != null, "Blame date is null for file %s at line %s", file.relativePath(), lineId);
}
private static void addChangeset(Builder scmBuilder, BlameLine line) {
@@ -131,7 +133,7 @@ class DefaultBlameOutput implements BlameOutput {
private static String removeNonAsciiCharacters(String inputString) {
return NON_ASCII_CHARS.matcher(inputString).replaceAll("_");
}
-
+
public void finish() {
progressReport.stop(count + "/" + total + " files analyzed");
if (!allFilesToBlame.isEmpty()) {