Throw_InCatch02.java revision 12651:6ef01bd40ce2
1263933Sbr/*
2263933Sbr * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
3263933Sbr * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4263933Sbr *
5263933Sbr * This code is free software; you can redistribute it and/or modify it
6263933Sbr * under the terms of the GNU General Public License version 2 only, as
7263933Sbr * published by the Free Software Foundation.
8263933Sbr *
9263933Sbr * This code is distributed in the hope that it will be useful, but WITHOUT
10263933Sbr * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11263933Sbr * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12263933Sbr * version 2 for more details (a copy is included in the LICENSE file that
13263933Sbr * accompanied this code).
14263933Sbr *
15263933Sbr * You should have received a copy of the GNU General Public License version
16263933Sbr * 2 along with this work; if not, write to the Free Software Foundation,
17263933Sbr * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18263933Sbr *
19263933Sbr * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20278599Sian * or visit www.oracle.com if you need additional information or have any
21266943Sbr * questions.
22266943Sbr */
23263933Sbr/*
24266943Sbr */
25266943Sbrpackage org.graalvm.compiler.jtt.except;
26
27import org.junit.Test;
28
29import org.graalvm.compiler.jtt.JTTTest;
30
31public class Throw_InCatch02 extends JTTTest {
32
33    public static boolean test(int i) throws Exception {
34        if (i == 0) {
35            return true;
36        }
37        try {
38            throwE();
39        } catch (Exception e) {
40            throwE(e);
41        }
42        return false;
43    }
44
45    private static void throwE(Exception e) throws Exception {
46        throw e;
47    }
48
49    private static void throwE() throws Exception {
50        throw new Exception();
51    }
52
53    @Test
54    public void run0() throws Throwable {
55        runTest("test", 0);
56    }
57
58    @Test
59    public void run1() throws Throwable {
60        runTest("test", 1);
61    }
62
63}
64