You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Jim Krueger (Jira)" <ji...@apache.org> on 2020/05/06 19:01:00 UTC

[jira] [Updated] (CXF-8278) @Path with regular expression containing parentheses does not resolve correctly

     [ https://issues.apache.org/jira/browse/CXF-8278?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jim Krueger updated CXF-8278:
-----------------------------
    Description: 
Currently the constructor for org.apache.cxf.jaxrs.model.URITemplate adds parentheses around the regex pattern.  However, if a user specifies a regex already containing parentheses (for example: @Path(*"_/{example : (*[0-9a-f]*{4}.|*[0-9a-f]*{8}_**_.)}/test/\{file}_"*) then the URITemplate constructor will add additional parenthesis around the pattern for the "example" field.   This will result in the  Regex expression as being a group within another group and will cause the Matcher returned from Pattern.matcher() to contain duplicate values for this regex pattern.  As a result, the values will not match the values. 

The URITemplate constructor should be changed to only add parentheses if they do not already exist.

  was:
Currently the constructor for org.apache.cxf.jaxrs.model.URITemplate adds parentheses around the regex pattern.  However, if a user specifies a regex already containing parentheses (for example: @Path("/\{example : ([0-9a-f]{4}-.*|[0-9a-f]\{8}-.*)}/test/\{file}") then the URITemplate constructor will add additional parenthesis around the pattern for the "example" field.   This will result in the  Regex expression as being a group within another group and will cause the Matcher returned from Pattern.matcher() to contain duplicate values for this regex pattern.  As a result, the values will not match the values.  

The URITemplate constructor should be changed to only add parentheses if they do not already exist.


> @Path with regular expression containing parentheses does not resolve correctly
> -------------------------------------------------------------------------------
>
>                 Key: CXF-8278
>                 URL: https://issues.apache.org/jira/browse/CXF-8278
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.3.6
>            Reporter: Jim Krueger
>            Priority: Major
>             Fix For: 3.3.6
>
>
> Currently the constructor for org.apache.cxf.jaxrs.model.URITemplate adds parentheses around the regex pattern.  However, if a user specifies a regex already containing parentheses (for example: @Path(*"_/{example : (*[0-9a-f]*{4}.|*[0-9a-f]*{8}_**_.)}/test/\{file}_"*) then the URITemplate constructor will add additional parenthesis around the pattern for the "example" field.   This will result in the  Regex expression as being a group within another group and will cause the Matcher returned from Pattern.matcher() to contain duplicate values for this regex pattern.  As a result, the values will not match the values. 
> The URITemplate constructor should be changed to only add parentheses if they do not already exist.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)