Issue Details (XML | Word | Printable)

Key: GROOVY-1876
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Critical Critical
Assignee: Jochen Theodorou
Reporter: Stefan Saring
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
groovy

try-finally does not always executes the finally block when used in methods with return values

Created: 05/May/07 01:54 AM   Updated: 02/Jul/07 08:24 AM
Component/s: None
Affects Version/s: 1.0, 1.1-beta-1
Fix Version/s: 1.1-beta-2

Time Tracking:
Not Specified

File Attachments: 1. File test.groovy (0.2 kB)

Environment: Ubuntu Linux 6.10, Java SE 6, Groovy 1.1 Beta 1

Testcase included: yes


 Description  « Hide
When using a try-finally block in methods with return values then the finally block will not always be executed.
Here's a script which demonstrates the problem:

boolean foo () {
try { println "try" // only when next line is removed then the finally-block will be executed if (0 == 1) return false return true }
finally { println "finally" }
}

foo ()

Output after starting: eddie@saringnb:~$ groovy test.groovy
try

Finally will only be executed when removing the line " if (0 == 1) return false".

I've reported a similar problem for Groovy 1.0 (http://jira.codehaus.org/browse/GROOVY-1663), probably it was not solved completely.

BTW: Is there a planning for a bugfix release (e.g. 1.0.1) without new features which just removes these critical bugs? Would be important for production usage.

Thanks in advance,
Stefan



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Stefan Saring added a comment - 05/May/07 02:05 AM
I've attached the test script. It's the same as in the bug description, but unfortunately the newlines were removed in the description text.

Jochen Theodorou added a comment - 02/Jul/07 08:24 AM
fixed