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 2021/06/07 13:15:06 UTC
[jira] [Closed] (JEXL-280) break/continue statements outside of the
loop
[ https://issues.apache.org/jira/browse/JEXL-280?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Henri Biestro closed JEXL-280.
------------------------------
> 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
(v8.3.4#803005)