]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3644 Fix issue when matching component key against original file pattern
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Tue, 10 Sep 2013 08:02:40 +0000 (10:02 +0200)
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Tue, 10 Sep 2013 08:02:40 +0000 (10:02 +0200)
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/pattern/Pattern.java
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/pattern/PatternsInitializer.java

index e46c7c8d48ae9952f53174bab98e94e79da9b169..17ed6118a09e01baf438f6b45624ce9b4cf1c040 100644 (file)
@@ -155,6 +155,10 @@ public class Pattern {
     return resource != null && resourcePattern.match(resource);
   }
 
+  public Pattern forResource(String resource) {
+    return new Pattern(resource, rulePattern.toString(), lineRanges).setCheckLines(isCheckLines());
+  }
+
   @Override
   public String toString() {
     return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
index d98b50a9efec9e1db77d870ba01ed771f9a9c9f3..5681d23d9dd5636ef8ea18baf2a8d65966828274 100644 (file)
@@ -145,6 +145,6 @@ public class PatternsInitializer implements BatchExtension {
       List<Pattern> newList = Lists.newArrayList();
       patternByComponent.put(component, newList);
     }
-    patternByComponent.get(component).add(pattern);
+    patternByComponent.get(component).add(pattern.forResource(component));
   }
 }