Vincent Bussol created JEXL-453:
-----------------------------------
Summary: Finally clause is not evaluated
Key: JEXL-453
URL: https://issues.apache.org/jira/browse/JEXL-453
Project: Commons JEXL
Issue Type: Bug
Affects Versions: 3.6.1
Reporter: Vincent Bussol
When a catch clause is present and no error occurs, the finally clause is not
evaluated.
{code:java}
try {
// do stuff; do not raise an error
} catch (const xerror) {
// manage error
} finally {
// not evaluated
}{code}
Here is a simple test:
{code:java}
@Test
void testTryCatchFinally() {
final String src = "try { return 42 } catch(const xerror){} finally {
return 169 }";
final JexlScript script = JEXL.createScript(src);
assertNotNull(script);
final Object result = script.execute(null);
assertEquals(169, result);
} {code}
I think that in the method {_}Interpreter#visit(final ASTTryStatement node,
final Object data){_}, the child offset is not updated correctly and the
finally block (node) is actually the catch variable.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)