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

Predicate Language parsing fails on semi-colon before "else" keyword


    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.1.3.Final
    • Fix Version/s: None
    • Component/s: Core, Predicate Language
    • Labels:


      The appropriate use of semi colons after a handler is not clear.  The docs say:


      Handlers are executed in order and separated by line breaks or semi colons.

      This implies that a semicolon should always be valid after a handler.  The semi colon is certainly optional as shown after the first handler here: 

      path(/foo) -> response-code(404) else response-code(503);

       And a semi colon is allowed when the first handler is encased in curly braces: 

      path(/foo) -> { response-code(404); } else { response-code(503); }

      However, this example throws a parsing error: 

      path(/foo) -> response-code(404); else response-code(503);

      With the error: 

      Error parsing predicated handler string Invalid expression

      I think that last example should be valid since the next text after the first handler is "else".  I've been caught off guard a few times when I put semi colons after handlers, but then I have an example like above and receive a parsing error.  It doesn't seem necessary to need to use the curly braces unless I have more than one handler I want to group together. 

      The predicate DSL is clearly borrowing from most scripting languages like Java or JS where pseudo code like this would be valid: 

      if( condition )

      In that pseudo code, the first semi colon doesn't terminate the entire if statement, so it doesn't seem correct that the Undertow Predicate language treats it that way.


        Gliffy Diagrams




              • Assignee:
                flavia.rainone Flavia Rainone
                bdw429s Brad Wood
              • Votes:
                0 Vote for this issue
                1 Start watching this issue


                • Created: