[ 
https://issues.apache.org/jira/browse/JEXL-280?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Henri Biestro resolved JEXL-280.
--------------------------------
       Resolution: Fixed
         Assignee: Henri Biestro
    Fix Version/s: 3.2

Added stack of loop counters in parser and tests.
https://github.com/apache/commons-jexl/commit/1a9f28fb6992c641af1c12531716e18dcde4fad6

> 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)

Reply via email to