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

Pragmas with antish names are broken

    XMLWordPrintableJSON

Details

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

    Description

      The test cases in PragmaTest.java are now silently swallowing parsing exceptions of tests with antish pragma names. In fact we should report a test error if there is any exception caught during test run.

          @Test
          public void testPragmas() throws Exception {
              JexlContext jc = new MapContext();
              try {
                  JexlScript script = JEXL.createScript("#pragma one 1\n#pragma the.very.hard 'truth'\n2;");
                  Assert.assertTrue(script != null);
                  Map<String, Object> pragmas = script.getPragmas();
                  Assert.assertEquals(2, pragmas.size());
                  Assert.assertEquals(1, pragmas.get("one"));
                  Assert.assertEquals("truth", pragmas.get("the.very.hard"));
              } catch (JexlException xjexl) {
                  String s = xjexl.toString();
                  /* We need to add this to the test */ 
                  Assert.fail("Should not fail with: " + s);
              }
          }
      

      As for the problem itself, now a jexl script will not parse correctly with pragmas specifying antish name, like the example specified in the documentation:

      #pragma execution.option 42
      

      Attachments

        Activity

          People

            henrib Henri Biestro
            dmitri_blinov Dmitri Blinov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: