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 2016/05/10 18:03:13 UTC

[jira] [Reopened] (JEXL-193) InterruptedException is swallowed in function call in silent and non-strict mode

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

Henri Biestro reopened JEXL-193:
--------------------------------

Conclusion is that we need another flag to control how 'cancellation' is handled. The specification is the following:

The 'cancellable' option - accessible through the JexlBuilder & JexlEngine.Options - determines what happens when a script/expression/callable/closure is interrupted or cancelled during evaluation. When cancellable is true, a JexlException.Cancel is thrown; when false, the script execution stops and returns null.
Default behavior is to be cancellable when verbose (i.e. not silent, throw exceptions on errors)  and strict (considering interrupt as an error).

> InterruptedException is swallowed in function call in silent and non-strict mode
> --------------------------------------------------------------------------------
>
>                 Key: JEXL-193
>                 URL: https://issues.apache.org/jira/browse/JEXL-193
>             Project: Commons JEXL
>          Issue Type: Bug
>    Affects Versions: 3.0
>            Reporter: Dmitri Blinov
>            Assignee: Henri Biestro
>             Fix For: 3.0.1
>
>
> The following test case fails with 
> {code}
> java.lang.AssertionError: Values should be different. Actual: 42
> 	at org.junit.Assert.fail(Assert.java:88)
> 	at org.junit.Assert.failEquals(Assert.java:185)
> 	at org.junit.Assert.assertNotEquals(Assert.java:161)
> {code}
> {code}
>     public static class TestContext extends MapContext implements JexlContext.NamespaceResolver {
>         public int interrupt() throws InterruptedException {
>             throw new InterruptedException();
>         }
>     }
>     @Test
>     public void testInterrupt() throws Exception {
>         JexlEngine jexl = new JexlBuilder().arithmetic(new JexlArithmetic(false)).strict(false).silent(true).create();
>         JexlScript e = jexl.createScript("interrupt(); return 42");
>         Callable<Object> c = e.callable(new TestContext());
>         Object t = c.call();
>         Assert.assertNotEquals(42, t);
>     }
> {code}
> Expected behaviour is to cancel script execution



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)