caelum / vraptor

Simple Java Web MVC Framework

Home Page:http://vraptor.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@Path with regex containing a single group and |

YvesHenri opened this issue · comments

I'm mapping my controllers to be a REST API, so I annotate them with @Path("/api/v{version:XXXXX}").
At first, XXXXX used to be (\\d+\\.?\\d*|\\d*\\.\\d+), however DefaultParametersControl.compilePattern appends ( and ) to my regex, at line 87 (version 4.2.0-RC5), making it TWO groups (((expressions))). This then breaks at line 155, within the fillIntoRequest method of the same class (IndexOutOfBoundsException), since the above path implies a single parameter (version) with a matcher group count of 2.

To fix this, @path must be \\d+\\.?\\d*|\\d*\\.\\d+ (without parentheses), which doesn't sound and look correct to me. I believe there should be some checks before appending both parentheses to the final regex.

Wrong repo.