[
https://issues.apache.org/jira/browse/GROOVY-8085?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15859972#comment-15859972
]
Craig Silverstein commented on GROOVY-8085:
-------------------------------------------
Hmm, I tried 4 different javas:
{code}
java-1.7.0-openjdk-amd64 1071 /usr/lib/jvm/java-1.7.0-openjdk-amd64
java-1.8.0-openjdk-amd64 1069 /usr/lib/jvm/java-1.8.0-openjdk-amd64
java-8-oracle 1072 /usr/lib/jvm/java-8-oracle
java-gcj-4.8 /usr/lib/jvm/java-gcj-4.8
{code}
and they all gave the same output, so it would seem that this is behaving how
java wants it to. But it doesn't make any sense. I'm confused.
> 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)