GNU header update.
[cacao.git] / tests / kaffe / UncaughtException.java
1 /**
2  *  This test checks that we indeed invoke the UncaughtException method
3  *  for dying threads and that we ignore exceptions in it.
4  *
5  *  @author Godmar Back <gback@cs.utah.edu>
6  */
7 public class UncaughtException {
8     public static void main(String av[]) {
9         ThreadGroup g = new ThreadGroup("testgroup") {
10             int i;
11             public void uncaughtException(Thread t, Throwable e) {
12                 synchronized (this) {
13                     i++;
14                     if (i == 2) {
15                         ((Object)null).hashCode();
16                     }
17                     System.out.println("Success " + i + ".");
18                 }
19             }
20         };
21
22         for (int i = 0; i < 3; i++) {
23             new Thread(g, new Integer(i).toString()) {
24                 public void run() {
25                     throw new RuntimeException();
26                 }
27             }.start();
28         }
29     }
30 }
31
32 /* Expected Output:
33 Success 1.
34 Success 3.
35 */