diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2011-01-26 18:26:39 +0100 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2011-01-26 18:26:39 +0100 |
commit | 88fd3df4a2a3f63723e38674935b7c8f1f97f14b (patch) | |
tree | 82daeac35aea6b66edb2d985180ac9bfeebd2ef4 /sonar-batch | |
parent | 1d5d71eebad9c3e375b2dfb71c6cfd87bf67951d (diff) | |
download | sonarqube-88fd3df4a2a3f63723e38674935b7c8f1f97f14b.tar.gz sonarqube-88fd3df4a2a3f63723e38674935b7c8f1f97f14b.zip |
SONAR-2130 Fix backward-compatibility: resources can be automatically indexed when adding data
Diffstat (limited to 'sonar-batch')
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java index 01ba7d6b384..f29551c1e29 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java +++ b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java @@ -32,10 +32,7 @@ import org.sonar.api.database.model.ResourceModel; import org.sonar.api.design.Dependency; import org.sonar.api.measures.*; import org.sonar.api.profiles.RulesProfile; -import org.sonar.api.resources.Project; -import org.sonar.api.resources.ProjectLink; -import org.sonar.api.resources.Resource; -import org.sonar.api.resources.ResourceUtils; +import org.sonar.api.resources.*; import org.sonar.api.rules.ActiveRule; import org.sonar.api.rules.Violation; import org.sonar.api.utils.SonarException; @@ -489,17 +486,19 @@ public final class DefaultIndex extends SonarIndex { } } - private Bucket checkIndexed(Resource reference) { - Bucket bucket = getBucket(reference, true); + private Bucket checkIndexed(Resource resource) { + Bucket bucket = getBucket(resource, true); if (bucket == null) { if (lock.isLocked()) { if (lock.isFailWhenLocked()) { - throw new ResourceNotIndexedException(reference); + throw new ResourceNotIndexedException(resource); } - LOG.warn("Resource will be ignored in next Sonar versions, index is locked: " + reference); - } else { - // other languages than Java - keep backward compatibility - bucket = doIndex(reference); + LOG.warn("Resource will be ignored in next Sonar versions, index is locked: " + resource); + } + if (Scopes.isDirectory(resource) || Scopes.isFile(resource)) { + bucket = doIndex(resource); + } else if (!lock.isLocked()) { + LOG.warn("Resource will be ignored in next Sonar versions, it must be indexed before adding data: " + resource); } } return bucket; |