From ede312df67174193caae2ec087a5319a36e0d647 Mon Sep 17 00:00:00 2001 From: Evgeny Mandrikov Date: Mon, 14 Feb 2011 13:56:49 +0300 Subject: [PATCH] SONAR-2193 Pattern matching should work in case if pattern ends on "/**" --- .../src/test/java/org/sonar/java/PatternUtilsTest.java | 2 +- .../src/main/java/org/sonar/api/utils/WildcardPattern.java | 2 +- .../src/test/java/org/sonar/api/utils/WildcardPatternTest.java | 2 -- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/PatternUtilsTest.java b/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/PatternUtilsTest.java index bb968b06821..d10b9254f02 100644 --- a/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/PatternUtilsTest.java +++ b/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/PatternUtilsTest.java @@ -34,6 +34,6 @@ public class PatternUtilsTest { assertThat(patterns.length, is(2)); assertThat(patterns[0].match("org/sonar/Foo"), is(true)); - assertThat(patterns[1].match("javax.Bar"), is(true)); + assertThat(patterns[1].match("javax/Bar"), is(true)); } } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/WildcardPattern.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/WildcardPattern.java index 2f1a46a9a1d..0403d82aa3b 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/WildcardPattern.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/WildcardPattern.java @@ -48,7 +48,7 @@ public class WildcardPattern { String patternStr = removeSlahesToIgnore(wildcardPattern); patternStr = StringUtils.replace(patternStr, "**/**", "**"); patternStr = StringUtils.replace(patternStr, "**/", "(&/|)"); - patternStr = StringUtils.replace(patternStr, "/**", "&"); + patternStr = StringUtils.replace(patternStr, "/**", "/&"); patternStr = StringUtils.replace(patternStr, "**", "&"); StringBuilder sb = new StringBuilder(); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/WildcardPatternTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/WildcardPatternTest.java index 16ece8c3704..0a5a7aeaff7 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/WildcardPatternTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/WildcardPatternTest.java @@ -24,7 +24,6 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; -import org.junit.Ignore; import org.junit.Test; public class WildcardPatternTest { @@ -106,7 +105,6 @@ public class WildcardPatternTest { /** * See http://jira.codehaus.org/browse/SONAR-2193 */ - @Ignore @Test public void issue2193() { assertTrue(match("**/app/**", "com.app.Utils", ".")); -- 2.39.5