You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Henri Biestro (JIRA)" <ji...@apache.org> on 2019/02/12 17:13:00 UTC

[jira] [Commented] (JEXL-280) break/continue statements outside of the loop

    [ https://issues.apache.org/jira/browse/JEXL-280?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16766256#comment-16766256 ] 

Henri Biestro commented on JEXL-280:
------------------------------------

Changeset: 31eec803d83bab7fe157f40f932bab63aaee22aa
Author:    henrib <he...@apache.org>
Date:      2019-02-12 18:11
Message:   JEXL-280: found new case when lambda created within loop of a lambda, fixed loop counter stack management

> break/continue statements outside of the loop
> ---------------------------------------------
>
>                 Key: JEXL-280
>                 URL: https://issues.apache.org/jira/browse/JEXL-280
>             Project: Commons JEXL
>          Issue Type: Bug
>    Affects Versions: 3.1
>            Reporter: Dmitri Blinov
>            Assignee: Henri Biestro
>            Priority: Major
>             Fix For: 3.2
>
>
> As of now Jexl checks if the {{break}} and {{continue}} statements are only used inside the {{loop}} statements, if not - the parsing execption is thrown. But the checks do not fire inside the nested function declaration, if the function itself is declared inside the {{loop}} statement.
> The following test case illustates the problem.
> {code:java}
>     @Test
>     public void testForEachBreakBrokenInsideFunction() throws Exception {
>         try {
>             JexlScript e = JEXL.createScript("for (i : 1..2) y = function() {break}}");
>             Assert.fail("break is out of loop!");
>         } catch (JexlException.Parsing xparse) {
>             String str = xparse.detailedMessage();
>             Assert.assertTrue(str.contains("break"));
>         }
>     }
> {code}
> The suggested behaviour is to throw the parsing exception.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)