cbuschka / beanshell2

Automatically exported from code.google.com/p/beanshell2
0 stars 0 forks source link

Finally block is not executed if an exception is thrown in the previous catch block #93

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The following code shows the problem:

try {
    System.out.println("try");
    throw new Exception("1");
} catch (Exception e) {
    System.out.println("catch");
    throw new Exception("2");
} finally {
    System.out.println("finally");
}

The expected output is
try
catch
finally
and the exception "2" remains uncaught.

The actual output is
try
catch
and the exception "2" remains uncaught.

The problem is in the file BSHTryStatement.java
I think lines 86 to 176 should be in a try block, and lines 178 to 183 in the 
corresponding finally block.

Original issue reported on code.google.com by lorenzo....@gmail.com on 5 Nov 2013 at 9:41

GoogleCodeExporter commented 8 years ago
Thank you for reporting, will look at this

Original comment by pejob...@gmail.com on 6 Nov 2013 at 8:13

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Applied your suggested fix in v2.1 branch

Original comment by pejob...@gmail.com on 6 Nov 2013 at 9:05