javaclass

Changeset

19:83643c18d613
2004-11-09 Paul Boddie raw files shortlog changelog graph Added a test of try...finally. Note that this exposes issues with revision 1.10 of bytecode.py, since the exception is not re-raised.
tests/ExceptionTest.java (file)
     1.1 --- a/tests/ExceptionTest.java	Tue Nov 09 20:00:59 2004 +0100
     1.2 +++ b/tests/ExceptionTest.java	Tue Nov 09 20:05:58 2004 +0100
     1.3 @@ -8,7 +8,20 @@
     1.4          }
     1.5      }
     1.6  
     1.7 -    public int testFinally(int x) {
     1.8 +    public int testFinally(int x) throws java.lang.Exception {
     1.9 +        try {
    1.10 +            if (x == 0) {
    1.11 +                throw new MyException();
    1.12 +            } else if (x == 1) {
    1.13 +                throw new MyOtherException();
    1.14 +            }
    1.15 +        } finally {
    1.16 +            x = 1;
    1.17 +        }
    1.18 +        return x;
    1.19 +    }
    1.20 +
    1.21 +    public int testCatchFinally(int x) {
    1.22          try {
    1.23              if (x == 0) {
    1.24                  throw new MyException();