1.1 --- a/tests/ExceptionTest.java Tue Nov 09 20:05:58 2004 +0100
1.2 +++ b/tests/ExceptionTest.java Wed Nov 10 15:54:09 2004 +0100
1.3 @@ -1,18 +1,51 @@
1.4 public class ExceptionTest {
1.5
1.6 - public int testCatch() {
1.7 - try {
1.8 + public int testThrow(int x) throws java.lang.Exception {
1.9 + if (x == 0) {
1.10 throw new MyException();
1.11 + } else if (x == 1) {
1.12 + throw new MyOtherException();
1.13 + } else {
1.14 + return 1;
1.15 + }
1.16 + }
1.17 +
1.18 + public int testCatch(int x) {
1.19 + try {
1.20 + if (x == 0) {
1.21 + throw new MyException();
1.22 + } else if (x == 1) {
1.23 + throw new MyOtherException();
1.24 + } else {
1.25 + x = 1;
1.26 + }
1.27 } catch (MyException exc) {
1.28 - return 1;
1.29 + x = 3;
1.30 + } catch (MyOtherException exc) {
1.31 + x = 2;
1.32 + }
1.33 + return x;
1.34 + }
1.35 +
1.36 + public int testIncomingCatch(int x) {
1.37 + try {
1.38 + return testThrow(x);
1.39 + } catch (MyException exc) {
1.40 + return 3;
1.41 + } catch (MyOtherException exc) {
1.42 + return 2;
1.43 + } catch (java.lang.Exception exc) {
1.44 + return -1; // Should be unreachable, really.
1.45 }
1.46 }
1.47
1.48 public int testFinally(int x) throws java.lang.Exception {
1.49 try {
1.50 if (x == 0) {
1.51 + x = 3;
1.52 throw new MyException();
1.53 } else if (x == 1) {
1.54 + x = 2;
1.55 throw new MyOtherException();
1.56 }
1.57 } finally {