aboutsummaryrefslogtreecommitdiff
path: root/src/test/test1/GetThrowables.java
blob: 11ff3e0571b006e89a0b9efd6f215bd0771d8258 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package test1;

class GetThrow1 extends Exception {

    /** default serialVersionUID */
    private static final long serialVersionUID = 1L;
}

class GetThrow2 extends Exception {

    /** default serialVersionUID */
    private static final long serialVersionUID = 1L;
}

public class GetThrowables {
    int k = 0;

    public void m1() throws GetThrow1, GetThrow2 {
	if (k < 0)
	    throw new GetThrow1();
	else if (k == 1)
	    throw new GetThrow2();

	k = 1;
    }

    public int run() throws GetThrow2 {
	int i = 0;
	try {
	    try {
		m1();
	    }
	    catch (GetThrow1 e) {
		i = 1;
		throw e;
	    }
	    finally {
		i += 3;
	    }
	}
	catch (GetThrow1 e2) {
	    ++i;
	}

	return i;
    }
}