Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id EF083200B3B for ; Mon, 11 Jul 2016 11:52:12 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id EDB82160A62; Mon, 11 Jul 2016 09:52:12 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 45A52160A7D for ; Mon, 11 Jul 2016 11:52:12 +0200 (CEST) Received: (qmail 79509 invoked by uid 500); 11 Jul 2016 09:52:11 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 79091 invoked by uid 99); 11 Jul 2016 09:52:11 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Jul 2016 09:52:11 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 077192C02A8 for ; Mon, 11 Jul 2016 09:52:11 +0000 (UTC) Date: Mon, 11 Jul 2016 09:52:11 +0000 (UTC) From: "Henri Biestro (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (JEXL-204) Script is not interrupted by a method call throwing Exception MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 11 Jul 2016 09:52:13 -0000 [ https://issues.apache.org/jira/browse/JEXL-204?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Henri Biestro updated JEXL-204: ------------------------------- Fix Version/s: 3.0.1 > Script is not interrupted by a method call throwing Exception > ------------------------------------------------------------- > > Key: JEXL-204 > URL: https://issues.apache.org/jira/browse/JEXL-204 > 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 the message > {quote} > java.lang.AssertionError: should have thrown a Cancel > at org.junit.Assert.fail(Assert.java:88) > at org.apache.commons.jexl3.ScriptInterruptableTest.testExceptionCancellable(ScriptInterruptableTest.java:73) > {quote} > {code} > @SuppressWarnings({"UnnecessaryBoxing", "AssertEqualsBetweenInconvertibleTypes"}) > public class ScriptInterruptableTest extends JexlTestCase { > //Logger LOGGER = Logger.getLogger(VarTest.class.getName()); > public ScriptInterruptableTest() { > super("ScriptInterruptableTest"); > } > public static class DummyInterrupt { > public int except() throws Exception { > throw new Exception("Cancelled by purpose"); > } > } > public static class TestContext extends MapContext implements JexlContext.NamespaceResolver { > @Override > public Object resolveNamespace(String name) { > return name == null ? this : null; > } > } > @Test > public void testExceptionCancellable() throws Exception { > JexlEngine jexl = new JexlBuilder().silent(true).strict(false).cancellable(true).create(); > JexlContext ctxt = new TestContext(); > ctxt.set("x", new DummyInterrupt()); > // run an interrupt > JexlScript sint = jexl.createScript("x.except(); return 42"); > Object t = null; > Script.Callable c = (Script.Callable) sint.callable(ctxt); > try { > t = c.call(); > if (c.isCancellable()) { > Assert.fail("should have thrown a Cancel"); > } > } catch (JexlException.Cancel xjexl) { > if (!c.isCancellable()) { > Assert.fail("should not have thrown " + xjexl); > } > } > Assert.assertTrue(c.isCancelled()); > Assert.assertNotEquals(42, t); > } > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)