commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dmitri Blinov (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (JEXL-193) InterruptedException is swallowed in function call in silent and non-strict mode
Date Fri, 06 May 2016 16:31:13 GMT

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

Dmitri Blinov edited comment on JEXL-193 at 5/6/16 4:31 PM:
------------------------------------------------------------

As I understand that will be only one part of the solution. From the point of monitoring thread
I will know the executing thread has timed out, the problem is that will just not prevent
the executing thread from continuing. The solution still needs the other part, to allow the
executing thread to know it was interrupted and need not to continue. In silent mode jexl
will break script execution but will clear thread's interrupted state and return null instead
of throwing exception. From the point of executing thread the returned null may be a valid
result, not a signal about something went wrong. So the executing thread will never know it
is timed out and continue its transaction as normal.


was (Author: dmitri_blinov):
As I understand that will be only one part of the solution. From the point of monitoring thread
I will know the executing thread has timed out, the problem is that will just not prevent
the executing thread from continuing. 

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

Mime
View raw message