diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2012-11-25 00:00:50 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2012-11-26 13:55:54 +0100 |
commit | a38602149510e58a7f2421faa02327feb8236396 (patch) | |
tree | a28902b1b3acfa2a3c877c42d845e0f54f7ea68b /sonar-core | |
parent | 2704d7b445807d96e62ab8bd51382f2069e9875b (diff) | |
download | sonarqube-a38602149510e58a7f2421faa02327feb8236396.tar.gz sonarqube-a38602149510e58a7f2421faa02327feb8236396.zip |
SONAR-3825 fix loading of qualifiers in the form
Diffstat (limited to 'sonar-core')
-rw-r--r-- | sonar-core/src/main/java/org/sonar/core/measure/MeasureFilter.java | 8 | ||||
-rw-r--r-- | sonar-core/src/main/java/org/sonar/core/measure/MeasureFilterExecutor.java | 4 |
2 files changed, 10 insertions, 2 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/measure/MeasureFilter.java b/sonar-core/src/main/java/org/sonar/core/measure/MeasureFilter.java index 5c4d247a6d6..41f987dd579 100644 --- a/sonar-core/src/main/java/org/sonar/core/measure/MeasureFilter.java +++ b/sonar-core/src/main/java/org/sonar/core/measure/MeasureFilter.java @@ -23,8 +23,8 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Strings; import com.google.common.collect.Lists; import org.apache.commons.lang.builder.ReflectionToStringBuilder; -import org.apache.commons.lang.builder.ToStringStyle; import org.sonar.api.measures.Metric; +import org.sonar.api.resources.Qualifiers; import javax.annotation.Nullable; @@ -76,6 +76,12 @@ public class MeasureFilter { public MeasureFilter setResourceQualifiers(@Nullable List<String> list) { this.resourceQualifiers = sanitize(list); + if (resourceQualifiers.contains(Qualifiers.FILE)) { + resourceQualifiers.add(Qualifiers.CLASS); + } + if (resourceQualifiers.contains(Qualifiers.DIRECTORY)) { + resourceQualifiers.add(Qualifiers.PACKAGE); + } return this; } diff --git a/sonar-core/src/main/java/org/sonar/core/measure/MeasureFilterExecutor.java b/sonar-core/src/main/java/org/sonar/core/measure/MeasureFilterExecutor.java index 6b1bf54b3b8..0de8fad5f27 100644 --- a/sonar-core/src/main/java/org/sonar/core/measure/MeasureFilterExecutor.java +++ b/sonar-core/src/main/java/org/sonar/core/measure/MeasureFilterExecutor.java @@ -19,6 +19,7 @@ */ package org.sonar.core.measure; +import com.google.common.base.Strings; import org.apache.ibatis.session.SqlSession; import org.sonar.api.ServerComponent; import org.sonar.core.persistence.Database; @@ -75,7 +76,8 @@ public class MeasureFilterExecutor implements ServerComponent { } static boolean isValid(MeasureFilter filter, MeasureFilterContext context) { - boolean valid = !(filter.isOnBaseResourceChildren() && context.getBaseSnapshot() == null); + boolean valid = (Strings.isNullOrEmpty(filter.getBaseResourceKey()) || context.getBaseSnapshot()!=null); + valid &= !(filter.isOnBaseResourceChildren() && context.getBaseSnapshot() == null); valid &= !(filter.isOnFavourites() && context.getUserId() == null); valid &= validateMeasureConditions(filter); valid &= validateSort(filter); |