You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by GitBox <gi...@apache.org> on 2021/09/08 10:02:13 UTC

[GitHub] [cxf] jimma opened a new pull request #847: [CXF-8594]:Fix regular expression parameter with non-capturing group …

jimma opened a new pull request #847:
URL: https://github.com/apache/cxf/pull/847


   …doesn't work


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cxf] jimma commented on a change in pull request #847: [CXF-8594]:Fix regular expression parameter with non-capturing group …

Posted by GitBox <gi...@apache.org>.
jimma commented on a change in pull request #847:
URL: https://github.com/apache/cxf/pull/847#discussion_r705168948



##########
File path: rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/URITemplate.java
##########
@@ -83,7 +83,7 @@ public URITemplate(String theTemplate) {
                     // however do not add them if they already exist since that will cause the Matcher
                     // to create extraneous values.  Parens identify a group so multiple parens would
                     // indicate multiple groups.
-                    if (pattern.startsWith("(") && pattern.endsWith(")")) {
+                    if (pattern.startsWith("(") && pattern.endsWith(")") && !pattern.startsWith("(?:")) {

Review comment:
       @reta  You are right ! I don't know there is another non-capture group like (?>X) and so many lookahead/lookbehind expressions.  Regex is powerful!  I already improved the fix as you suggested. Please review it again. Thanks ! 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cxf] reta edited a comment on pull request #847: [CXF-8594]:Fix regular expression parameter with non-capturing group …

Posted by GitBox <gi...@apache.org>.
reta edited a comment on pull request #847:
URL: https://github.com/apache/cxf/pull/847#issuecomment-918447803


   @jimma this one could be integrated, right?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cxf] jimma commented on pull request #847: [CXF-8594]:Fix regular expression parameter with non-capturing group …

Posted by GitBox <gi...@apache.org>.
jimma commented on pull request #847:
URL: https://github.com/apache/cxf/pull/847#issuecomment-918726243


   @reta  what do you mean by integrated ?  


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cxf] reta commented on pull request #847: [CXF-8594]:Fix regular expression parameter with non-capturing group …

Posted by GitBox <gi...@apache.org>.
reta commented on pull request #847:
URL: https://github.com/apache/cxf/pull/847#issuecomment-918761533


   Thanks @jimma , I think you could merge it, right? Or you prefer me to merge and backport it? Thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cxf] reta commented on a change in pull request #847: [CXF-8594]:Fix regular expression parameter with non-capturing group …

Posted by GitBox <gi...@apache.org>.
reta commented on a change in pull request #847:
URL: https://github.com/apache/cxf/pull/847#discussion_r704417685



##########
File path: rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/URITemplate.java
##########
@@ -83,7 +83,7 @@ public URITemplate(String theTemplate) {
                     // however do not add them if they already exist since that will cause the Matcher
                     // to create extraneous values.  Parens identify a group so multiple parens would
                     // indicate multiple groups.
-                    if (pattern.startsWith("(") && pattern.endsWith(")")) {
+                    if (pattern.startsWith("(") && pattern.endsWith(")") && !pattern.startsWith("(?:")) {

Review comment:
       Thanks for the fix @jimma , I am wondering if we should cover other special constructs [1] with more broader`!pattern.startsWith("(?")` check, for example `(?>X)`, an independent, non-capturing group, etc
   
   ```
   (?<name>X) 	                X, as a named-capturing group
   (?:X) 	                        X, as a non-capturing group
   (?idmsuxU-idmsuxU)      Nothing, but turns match flags i d m s u x U on - off
   (?idmsux-idmsux:X)        X, as a non-capturing group with the given flags i d m s u x on - off
   (?=X) 	                        X, via zero-width positive lookahead
   (?!X) 	                        X, via zero-width negative lookahead
   (?<=X) 	                        X, via zero-width positive lookbehind
   (?<!X) 	                        X, via zero-width negative lookbehind
   (?>X) 	                        X, as an independent, non-capturing group
   ```
   
   [1] https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cxf] reta merged pull request #847: [CXF-8594]:Fix regular expression parameter with non-capturing group …

Posted by GitBox <gi...@apache.org>.
reta merged pull request #847:
URL: https://github.com/apache/cxf/pull/847


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cxf] jimma commented on pull request #847: [CXF-8594]:Fix regular expression parameter with non-capturing group …

Posted by GitBox <gi...@apache.org>.
jimma commented on pull request #847:
URL: https://github.com/apache/cxf/pull/847#issuecomment-918751717


   @reta  Sure. All tests are passed, and it's ready to merge. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cxf] jimma commented on pull request #847: [CXF-8594]:Fix regular expression parameter with non-capturing group …

Posted by GitBox <gi...@apache.org>.
jimma commented on pull request #847:
URL: https://github.com/apache/cxf/pull/847#issuecomment-918852286


   @reta  If you get time today to merge and backport , please give it go. Otherwise I'll back to look tomorrow morning.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cxf] reta commented on pull request #847: [CXF-8594]:Fix regular expression parameter with non-capturing group …

Posted by GitBox <gi...@apache.org>.
reta commented on pull request #847:
URL: https://github.com/apache/cxf/pull/847#issuecomment-918748856


   @jimma oh sorry, I meant - merged


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cxf] reta commented on a change in pull request #847: [CXF-8594]:Fix regular expression parameter with non-capturing group …

Posted by GitBox <gi...@apache.org>.
reta commented on a change in pull request #847:
URL: https://github.com/apache/cxf/pull/847#discussion_r705243746



##########
File path: rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/URITemplate.java
##########
@@ -83,7 +83,7 @@ public URITemplate(String theTemplate) {
                     // however do not add them if they already exist since that will cause the Matcher
                     // to create extraneous values.  Parens identify a group so multiple parens would
                     // indicate multiple groups.
-                    if (pattern.startsWith("(") && pattern.endsWith(")")) {
+                    if (pattern.startsWith("(") && pattern.endsWith(")") && !pattern.startsWith("(?:")) {

Review comment:
       👍 thanks @jimma !




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cxf] reta commented on pull request #847: [CXF-8594]:Fix regular expression parameter with non-capturing group …

Posted by GitBox <gi...@apache.org>.
reta commented on pull request #847:
URL: https://github.com/apache/cxf/pull/847#issuecomment-918447803


   @jimma this one could be integrated, right @jimma ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org