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

Script execution hangs while calling method with one argument without parameter

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0
    • Fix Version/s: 3.1
    • Labels:
      None

      Description

      While it is obviously an error to do such a thing, the script execution hangs indefinitely if the method with one argument of type Object is called without any parameter at all.

          public static class TestContext extends MapContext implements JexlContext.NamespaceResolver {
              @Override
              public Object resolveNamespace(String name) {
                  return name == null ? this : null;
              }
      
              public int hangs(Object t) {
                  return 1;
              }
          }
      
          public void testHangs() throws Exception {
              JexlScript e = JEXL.createScript("hangs()");
              Callable<Object> c = e.callable(new TestContext());
      
              ExecutorService executor = Executors.newFixedThreadPool(1);
              try {
                  Future<?> future = executor.submit(c);
                  Object t = future.get(10, TimeUnit.SECONDS);
                  Assert.assertEquals(1, t);
              } finally {
                  executor.shutdown();
              }
          }
      

      The expected behaviour is to report an error

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: