Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-8153

@Path with REGEX in path parameter and checkMethodsForInvalidURITemplates(userType, methods);

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.3.4
    • Fix Version/s: 3.3.5, 3.4.0
    • Component/s: JAX-RS
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      I have an API jar provided by the server, with the interface with all the JAX-RS annotations.
      One of then has an REGEX. Something like:

      @Path("{ resoureUUID : [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}}}")
      

      I can't create a proxy because the validation fails. Analyzing the code I get to
      org.apache.cxf.microprofile.client.Validator#checkMethodsForInvalidURITemplates(Class, Method[]), more specifically to this part (with comments):

      for (Parameter p : method.getParameters()) {
                          PathParam pathParam = p.getAnnotation(PathParam.class);
                          if (pathParam != null) {
                              // don't know the spec, but setting this to "x" cause the URITemplate to
                             // throw new IllegalArgumentException("Value '" + sval + "' does not match variable " + var.getName() + " with pattern " + var.getPattern());
                              paramMap.put(pathParam.value(), "x");
                          }
                      }
                      try {
                          template.substitute(paramMap, Collections.<String>emptySet(), false);
                      } catch (IllegalArgumentException ex) {
                          throwException("VALIDATION_UNRESOLVED_PATH_PARAMS", userType, method);
                      }
      

      Not sure if this is a bug or by spec, but this prevents to use path params with regex, as the only regex that works must match "x".

        Attachments

          Activity

            People

            • Assignee:
              coheigea Colm O hEigeartaigh
              Reporter:
              luisalves00 Luís Alves

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment