groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jochen Theodorou (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GROOVY-8085) Exception in "finally" not caught by outer "try"
Date Fri, 17 Feb 2017 18:44:41 GMT

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

Jochen Theodorou commented on GROOVY-8085:
------------------------------------------

{code}
TRYCATCHBLOCK L3 L5 L5 java/lang/Exception
...
TRYCATCHBLOCK L3 L5 L6 null
{code}
one block is to catch Exception, the other to catch everything else for a rethrow or finally
block. Java should produce the same. There is of course the question of the order, which I
don´t remember anymore... so it might be possible the JVM wants the TRAYCATCHBLOCK instructions
here in reverse order for example. That´s something to compare with Java

> Exception in "finally" not caught by outer "try"
> ------------------------------------------------
>
>                 Key: GROOVY-8085
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8085
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.4.8
>         Environment: linux
>            Reporter: Craig Silverstein
>
> I would expect the following code to print `caughtt`:
> ```
> groovy -e 'try { try { true; } finally { 1 / 0 } } catch (e) { println "caughtt" }'
> ```
> But instead, it prints:
> ```
> Caught: java.lang.ArithmeticException: Division by zero
> java.lang.ArithmeticException: Division by zero
>         at script_from_command_line.run(script_from_command_line:1)
> ```
> Why is the exception, thrown by the `finally`, not being caught by the outer try/catch?



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message