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

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

Thanks Daniel for tracking this down so assiduously and fixing it!

Are there any workarounds I could use for environments that don't have the fix 
in it yet?  Some way to restructure the code so it doesn't trigger this bug?

The one I can think of is make sure that nothing inside the inner try/except 
tries to return anything.  That should be enough to avoid problems, is that 
right?  (The problem is I'm not sure how to avoid implicit return's in all 
contexts.)  Is there any other thing I can do?

> 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
>          Components: Compiler
>    Affects Versions: 2.4.8
>         Environment: linux
>            Reporter: Craig Silverstein
>            Assignee: Daniel Sun
>            Priority: Critical
>             Fix For: 2.4.10
>
>
> 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)

Reply via email to