Debian Codegraph @

test/harness/jpype/exc/ExceptionTest.java

raw symbols SCIP
1 /* ****************************************************************************
2 Licensed under the Apache License, Version 2.0 (the "License");
3 you may not use this file except in compliance with the License.
4 You may obtain a copy of the License at
5
6 http://www.apache.org/licenses/LICENSE-2.0
7
8 Unless required by applicable law or agreed to in writing, software
9 distributed under the License is distributed on an "AS IS" BASIS,
10 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 See the License for the specific language governing permissions and
12 limitations under the License.
13
14 See NOTICE file for details.
15 **************************************************************************** */
16 package jpype.exc;
17
18 public class ExceptionTest
19 {
20
21 public static void throwRuntime()
22 {
23 throw new RuntimeException("Foo");
24 }
25
26 public static void throwIOException() throws java.io.IOException
27 {
28 throw new java.io.IOException("Bar");
29 }
30
31 public static boolean delegateThrow(ExceptionThrower th)
32 {
33 try
34 {
35 th.throwIOException();
36 } catch (java.io.IOException ex)
37 {
38 return true;
39 } catch (Throwable ex)
40 {
41 System.out.println("Unexpected Exception during delegateThrow");
42 ex.printStackTrace();
43 }
44 System.out.println("Failed");
45 return false;
46 }
47
48 public static void throwChildTestException() throws ParentTestException
49 {
50 throw new ChildTestException();
51 }
52
53 public static void throwChain()
54 {
55 method1();
56 }
57
58 static void method1()
59 {
60 method2();
61 }
62
63 static void method2()
64 {
65 throw new RuntimeException("Inner");
66 }
67 }