[ 
https://issues.apache.org/jira/browse/SUREFIRE-1250?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15296786#comment-15296786
 ] 

Zoltan Haindrich commented on SUREFIRE-1250:
--------------------------------------------

[~tibor17]

yes ...i've read the documentation; i don't say it was crystal clear..but i've 
read it.

i've opened the source and looked into the code...this exception is caused by 
the unwrapping of the pattern

https://github.com/apache/maven-surefire/blob/master/surefire-api/src/main/java/org/apache/maven/surefire/testset/TestListResolver.java#L407

i've other example regexps which may be affected by the issue:
 * {{(A#test1|B#test2)}}
 * {{A\Q#\Etest}}

others may be exists..but if someone hits this thing...they don't have a clue 
why the regexp is bad - while it's perfectly correct

so I think a better exception should notify the user about the special nature 
of these regexps....because i've already downloaded the code; i've added a 
sample fix for the issue





> Regex testcase filtering: exception when hashmark is regex-quoted
> -----------------------------------------------------------------
>
>                 Key: SUREFIRE-1250
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1250
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Maven Surefire Plugin
>    Affects Versions: 2.19.1
>            Reporter: Zoltan Haindrich
>            Assignee: Tibor Digana
>            Priority: Minor
>         Attachments: SUREFIRE-1250.patch
>
>
> i've been using regex to select which tests to run...and i've got some wierd 
> exceptions when executing
> {{code}}
> mvn test "-Dtest=%regex[.*\Q#\E.*]"
> {{code}}
> executing the above command results in:
> {{code}}
> java.util.regex.PatternSyntaxException: 
> Illegal/unsupported escape sequence near index 1
> \E.*
>  ^
>       at 
> org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:364)
>       at 
> org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:274)
>       at 
> org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
>       at 
> org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:161)
> {{code}}
> i noticed earlier that maven might do some black-magic with these regexps in 
> the background ( i know that it should know the class name earlier; to avoid 
> starting testcases which will get entirely excluded...and thats cool )
> ...so..i assume maven does split the regex by the {{#}}; and that's okay - if 
> that can't be avoided; place some pointers in the documentation about it 
> and/or a more descriptive exception could be useful



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to