diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2011-02-07 15:48:48 +0100 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2011-02-07 15:48:48 +0100 |
commit | c07d90eea0a359fc37a7f49ab6ad6ea0a13d18b8 (patch) | |
tree | 347e9e642dc161e8c0e2efb3004b28557c0f0440 | |
parent | ebee9e8be46ed85227fb4ded4afb34f12d6d465f (diff) | |
download | sonarqube-c07d90eea0a359fc37a7f49ab6ad6ea0a13d18b8.tar.gz sonarqube-c07d90eea0a359fc37a7f49ab6ad6ea0a13d18b8.zip |
Prevent from adding violations to resources with scope<file
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java | 3 |
1 files changed, 3 insertions, 0 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 296571bc282..09529e5c1b3 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 @@ -294,7 +294,10 @@ public final class DefaultIndex extends SonarIndex { Resource resource = violation.getResource(); if (resource == null) { violation.setResource(currentProject); + } else if (!Scopes.isHigherThanOrEquals(resource, Scopes.FILE)){ + throw new IllegalArgumentException("Violations are only supported on files, directories and project"); } + Bucket bucket = checkIndexed(resource); if (bucket != null && !bucket.isExcluded()) { boolean isIgnored = !force && violationFilters != null && violationFilters.isIgnored(violation); |