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

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

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

JIRA jira@apache.org
Dmitri Blinov created JEXL-280:

             Summary: 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

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.
    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();
The suggested behaviour is to throw the parsing exception.

This message was sent by Atlassian JIRA