summaryrefslogtreecommitdiffstats
path: root/sonar-batch
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2014-01-10 09:36:09 +0100
committerJulien HENRY <julien.henry@sonarsource.com>2014-01-10 09:37:29 +0100
commit3345c91ba5d096750b7ca2602e68dc397d39e77c (patch)
tree28c0dd2f8e96033fa3e2987985867dd5115ca8df /sonar-batch
parentbe0d369cc442bde9fef51c9763580536f4ffb8e1 (diff)
downloadsonarqube-3345c91ba5d096750b7ca2602e68dc397d39e77c.tar.gz
sonarqube-3345c91ba5d096750b7ca2602e68dc397d39e77c.zip
SONAR-4783 Don't prevent views indexing
Diffstat (limited to 'sonar-batch')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/DefaultSensorContext.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/DefaultSensorContext.java b/sonar-batch/src/main/java/org/sonar/batch/DefaultSensorContext.java
index 3376c65013b..d52e6e7d2c2 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/DefaultSensorContext.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/DefaultSensorContext.java
@@ -19,6 +19,7 @@
*/
package org.sonar.batch;
+import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonar.api.batch.Event;
@@ -31,7 +32,7 @@ import org.sonar.api.measures.Metric;
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.Scopes;
import org.sonar.api.rules.Violation;
import org.sonar.api.utils.SonarException;
import org.sonar.core.measure.MeasurementFilters;
@@ -61,16 +62,21 @@ public class DefaultSensorContext implements SensorContext {
public boolean index(Resource resource) {
// SONAR-5006
- if (ResourceUtils.isPersistable(resource)) {
+ if (indexedByCore(resource)) {
logWarning();
return true;
}
return index.index(resource);
}
+ private boolean indexedByCore(Resource resource) {
+ return StringUtils.equals(Scopes.DIRECTORY, resource.getScope()) ||
+ StringUtils.equals(Scopes.FILE, resource.getScope());
+ }
+
public boolean index(Resource resource, Resource parentReference) {
// SONAR-5006
- if (ResourceUtils.isPersistable(resource)) {
+ if (indexedByCore(resource)) {
logWarning();
return true;
}
@@ -78,7 +84,7 @@ public class DefaultSensorContext implements SensorContext {
}
private void logWarning() {
- LOG.debug("Plugins are no more allowed to index physical resources like directories and files. This is now handled by the platform.", new SonarException(
+ LOG.debug("Plugins are no more responsible for indexing physical resources like directories and files. This is now handled by the platform.", new SonarException(
"Plugin should not index physical resources"));
}