groovy-notifications mailing list archives

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

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

Craig Silverstein commented on GROOVY-8085:
-------------------------------------------

Hmm, that looks right to me.

I tried running groovyc and then ran
{code}
java -cp ".:$GROOVY_HOME/lib/*" bad
{code}
and got the same output, so possibly the problem is with my version of java?  Here is what
it says:
{code}
% java -version
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
{code}

> 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