Uploaded image for project: 'Identity Gateway'
  1. Identity Gateway
  2. OPENIG-1220

matches() function for a query throws NPE when the request does not contain any query

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.5.0
    • Fix Version/s: 5.0.0
    • Component/s: Core
    • Labels:
    • Support Ticket IDs:
    • Sprint:
      OpenIG Sprint 89

      Description

      If a route contains a condition such as

      "condition": "${matches(request.uri.query, '^test$')}"
      

      and the request does not contain a query, such as http://openig.example.com/examples
      OpenIG throws a NPE:

      [http-bio-8080-exec-4] WARN  org.forgerock.openig.el.Expression - An error occurred while evaluating the expression ${matches(request.uri.query, '^test$')}
      java.lang.NullPointerException: null
      	at java.util.regex.Matcher.getTextLength(Matcher.java:1234)
      Wrapped by: javax.el.ELException: Error invoking function 'matches'
      	at de.odysseus.el.tree.impl.ast.AstFunction.eval(AstFunction.java:124)
      

      Note that it then ignores the route and behaviour is correct. However it would make sense to return "false" instead of "null"

      *Workaround*; testing for null query get rid of the NPE:

      "condition": "${(request.uri.query != null and matches(request.uri.query, '^test$'))}"
      

        Attachments

          Activity

            People

            • Assignee:
              violette Violette Roche Montane
              Reporter:
              nathalie.hoet Nathalie Hoet
            • Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: