[JBoss JIRA] (JBEE-158) EL 3 LambdaExpression failing with an exception irreversibly pollutes variable scope
by Scott Marlow (Jira)
[ https://issues.jboss.org/browse/JBEE-158?page=com.atlassian.jira.plugin.s... ]
Scott Marlow closed JBEE-158.
-----------------------------
> EL 3 LambdaExpression failing with an exception irreversibly pollutes variable scope
> ------------------------------------------------------------------------------------
>
> Key: JBEE-158
> URL: https://issues.jboss.org/browse/JBEE-158
> Project: JBoss Enterprise Spec APIs
> Issue Type: Bug
> Components: jboss-el-api
> Affects Versions: jboss-el-api_3.0_spec-1.0.2.Final
> Reporter: Paul Pogonyshev
> Assignee: Tomaž Cerar
> Priority: Major
> Labels: el-expresion, patch
> Fix For: jboss-el-api_3.0_spec-1.0.6.Final
>
> Attachments: lambda-expression-scoping-fix.diff
>
>
> 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:
> {noformat}
> 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".
> {noformat}
> Proposed fix will be attached as a short patch against 'javax/el/LambdaExpression.java'.
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
6 years, 1 month