Uploaded image for project: 'JBoss Enterprise Spec APIs'
  1. JBoss Enterprise Spec APIs
  2. JBEE-158

EL 3 LambdaExpression failing with an exception irreversibly pollutes variable scope

XMLWordPrintable

      When a lambda expression is exited with an exception, its variables are left on stack and cannot be removed from it without hacks. My usecase is a customly defined function that uses exceptions as means of non-local exit, but the bug triggers even without custom functions, as demonstrated below.

      Test case:

              ELProcessor  processor = new ELProcessor ();
              processor.defineBean ("x", null);
      
              try {
                  processor.eval ("(x -> x.bug ()) ('bug')");
              }
              catch (RuntimeException exception) {
                  // This is expected, there is no method bug() on strings.
              }
      
              processor.eval ("x");  // This must evaluate to null, but instead evaluates to "bug".
      

      Proposed fix will be attached as a short patch against 'javax/el/LambdaExpression.java'.

              tomazcerar Tomaž Cerar (Inactive)
              doublep_ Paul Pogonyshev (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: