1 /*
2 * @test
3 * @key cte_test
4 * @bug 4998314
5 * @summary compute_compiled_exc_handler() called with pending exception
6 * Fixed in JDK1.4.2_05 Respin b02
7 * @compile Test.java
8 * @run shell/timeout=240 Test4998313.sh
9 */
10
11 public class Test extends Thread {
12
13 void foo(String x) {
14 try { x.toString(); }
15 catch (Exception ee) { }
16 catch (ThreadDeath td) { System.out.println("THREAD DEATH!!!"); }
17 }
18
19 void test() {
20 for (int i=0; i<10000; i++) foo((i%100 == 0)? "" : null);
21 }
22
23 public static void main(String[] args) throws InterruptedException {
24 Test t = new Test();
25 t.start();
26 Thread thisThread = Thread.currentThread();
27 thisThread.sleep(20000); // 20 sec
28 for (int i=0; i<100; i++) {
29 System.out.println("KILL THREAD!");
30 t.stop();
31 }
32 System.exit(0);
33 }
34
35 public void run() {
36 for (int i=0; i<200000; i++) test();
37 }
38 }