aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch
diff options
context:
space:
mode:
authorJenkins CI <ci@sonarsource.com>2015-03-19 07:59:14 +0100
committerJenkins CI <ci@sonarsource.com>2015-03-19 07:59:14 +0100
commit3ea46c74d8202c3dd11bd3569204093bfb173946 (patch)
tree71ee65c0ae5f58d669bbf792b6f69c2b2483c7d0 /sonar-batch
parentc9a535a0b20abd025c79345fe8432211580aea5c (diff)
parent558d4f781df61964e0a1503be3bcf6ddcd2188ac (diff)
downloadsonarqube-3ea46c74d8202c3dd11bd3569204093bfb173946.tar.gz
sonarqube-3ea46c74d8202c3dd11bd3569204093bfb173946.zip
Automatic merge from branch-5.1
* origin/branch-5.1: Fix regression in SourcePersister SONAR-6296 Rename 2 of the default dashboards
Diffstat (limited to 'sonar-batch')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/index/SourcePersister.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/SourcePersister.java b/sonar-batch/src/main/java/org/sonar/batch/index/SourcePersister.java
index e27d9eca168..5a86495495d 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/index/SourcePersister.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/index/SourcePersister.java
@@ -107,14 +107,16 @@ public class SourcePersister implements ScanPersister {
session.commit();
} else {
// Update only if data_hash has changed or if src_hash is missing (progressive migration)
- if (!dataHash.equals(previousDto.getDataHash()) || !metadata.hash().equals(previousDto.getSrcHash())) {
+ boolean binaryDataUpdated = !dataHash.equals(previousDto.getDataHash());
+ boolean srcHashUpdated = !metadata.hash().equals(previousDto.getSrcHash());
+ if (binaryDataUpdated || srcHashUpdated) {
previousDto
.setBinaryData(data)
.setDataHash(dataHash)
.setSrcHash(metadata.hash())
.setLineHashes(lineHashesAsMd5Hex(inputFile));
- // Optimization do not change updated at when updating src_hash to avoid indexation by E/S
- if (!dataHash.equals(previousDto.getDataHash())) {
+ // Optimization only change updated at when updating binary data to avoid unecessary indexation by E/S
+ if (binaryDataUpdated) {
previousDto.setUpdatedAt(0L);
}
mapper.update(previousDto);