Skip to content

Commit

Permalink
fix for issue #279
Browse files Browse the repository at this point in the history
  • Loading branch information
Claudenw authored and slachiewicz committed Nov 6, 2024
1 parent 5c1b97b commit e8c2d72
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/main/java/org/codehaus/plexus/util/SelectorUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public static boolean matchPatternStart( String pattern, String str, boolean isC

public static boolean isAntPrefixedPattern( String pattern )
{
return pattern.length() > ( ANT_HANDLER_PREFIX.length() + PATTERN_HANDLER_SUFFIX.length() + 1 )
return pattern.length() > ( ANT_HANDLER_PREFIX.length() + PATTERN_HANDLER_SUFFIX.length())
&& pattern.startsWith( ANT_HANDLER_PREFIX ) && pattern.endsWith( PATTERN_HANDLER_SUFFIX );
}

Expand Down Expand Up @@ -283,7 +283,7 @@ private static String toOSRelatedPath( String pattern, String separator )

public static boolean isRegexPrefixedPattern( String pattern )
{
return pattern.length() > ( REGEX_HANDLER_PREFIX.length() + PATTERN_HANDLER_SUFFIX.length() + 1 )
return pattern.length() > ( REGEX_HANDLER_PREFIX.length() + PATTERN_HANDLER_SUFFIX.length())
&& pattern.startsWith( REGEX_HANDLER_PREFIX ) && pattern.endsWith( PATTERN_HANDLER_SUFFIX );
}

Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/codehaus/plexus/util/SelectorUtilsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void testExtractPattern() {
*/
@Test
public void testIsAntPrefixedPattern() {
assertFalse(SelectorUtils.isAntPrefixedPattern("%ant[A]")); // single char not allowed
assertTrue(SelectorUtils.isAntPrefixedPattern("%ant[A]")); // single char not allowed
assertTrue(SelectorUtils.isAntPrefixedPattern("%ant[AB]"));
assertFalse(SelectorUtils.isAntPrefixedPattern("%ant[]"));
assertFalse(SelectorUtils.isAntPrefixedPattern("*"));
Expand All @@ -61,7 +61,7 @@ public void testIsAntPrefixedPattern() {
*/
@Test
public void testIsRegexPrefixedPattern() {
assertFalse(SelectorUtils.isRegexPrefixedPattern("%regex[A]")); // single char not allowed
assertTrue(SelectorUtils.isRegexPrefixedPattern("%regex[A]")); // single char not allowed
assertTrue(SelectorUtils.isRegexPrefixedPattern("%regex[.*]"));
assertFalse(SelectorUtils.isRegexPrefixedPattern("%regex[]"));
assertFalse(SelectorUtils.isRegexPrefixedPattern("*"));
Expand Down

0 comments on commit e8c2d72

Please sign in to comment.