Uploaded image for project: 'Commons JEXL'
  1. Commons JEXL
  2. JEXL-304

Error parsing overview.limit.var

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.1
    • 3.2
    • None

    Description

      I'm a user and committer of the JXLS framework. It uses JEXL to evaluate expressions. Since JEXL 3 it's not possible to evaluate "overview.limit.var". It was possible in V2. In our context "var" means "Value At Risk". I know "var" is a reserved word in JEXL. But in this "dotted-variables" context I think JEXL should try to use it as a variable, because it makes no sense as a var (=define variable) command.

       

      public void testVar() {
        JexlEngine jexlEngine = new JexlBuilder().strict(false).create();
        JexlExpression jexlExpresssion =
            jexlEngine.createExpression("overview.limit.var");
      
        HashMap map3 = new HashMap();
        map3.put("var", "4711");
        HashMap map2 = new HashMap();
        map2.put("limit", map3);
        HashMap map = new HashMap();
        map.put("overview", map2);
      
        MapContext context = new MapContext(map);
        Object value = jexlExpresssion.evaluate(context);
        assertEquals("4711", value); // fails
      }
      

      Error message:

      org.apache.commons.jexl3.JexlException$Parsing: de.xmap.tools.jexl.JEXL3VariableTest.testVar@1:15 parsing error in '.'
        at org.apache.commons.jexl3.JexlEngine.createExpression(JexlEngine.java:304)
        at de.xmap.tools.jexl.JEXL3VariableTest.testVar(JEXL3VariableTest.java:107)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      Attachments

        Activity

          People

            henrib Henri Biestro
            xmarcus Marcus Warm
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: