| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 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 |
} |