Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-1581

RoutingHandler throws IllegalStateException when two templated paths are added for different methods

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.0.26.Final
    • None
    • None
    • None

      RoutingHandler routing = Handlers.routing()
      .get("/

      {param1}", ResponseCodeHandler.HANDLE_200)
      .post("/{param2}", ResponseCodeHandler.HANDLE_200); // throws!
      
      

      java.lang.IllegalStateException: UT000071: Cannot add path template /{param2}, matcher already contains an equivalent pattern /{param1}

      at io.undertow.util.PathTemplateMatcher.add(PathTemplateMatcher.java:110)
      at io.undertow.util.PathTemplateMatcher.add(PathTemplateMatcher.java:151)
      at io.undertow.server.RoutingHandler.add(RoutingHandler.java:129)

      
      

      If both registrations use the same parameter name, it works fine. Because the parameters are named differently the check in RoutingHandler:128 doesn't skip registration with allMethodsMatcher as it would otherwise.

              flaviarnn Flavia Rainone
              carterkozak Carter Kozak
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: