104 }
105 }
106
107 class NeverInvoked implements UncaughtExceptionHandler {
108 public void uncaughtException(Thread t, Throwable e) {
109 err.println("Test failure: This handler should never be invoked!");
110 }
111 }
112
113 public class Seppuku extends Thread implements Runnable {
114 public static void seppuku() { throw new RuntimeException("Seppuku!"); }
115
116 public void run() { seppuku(); }
117
118 public static void main(String[] args) throws Exception {
119 $mainBody
120 }
121 }
122 EOJAVA
123
124 Sys "$javac" "-source" "1.5" "Seppuku.java"
125 CheckCommandResults "$expectedRC" "$expectedOut" "$expectedErr" \
126 "$java" "Seppuku"
127 Cleanup
128 }
129
130 #----------------------------------------------------------------
131 # A thread is never alive after you've join()ed it.
132 #----------------------------------------------------------------
133 Run 0 "OK" "Exception in thread \"Thread-0\".*Seppuku" "
134 Thread t = new Seppuku();
135 t.start(); t.join();
136 if (! t.isAlive())
137 out.println(\"OK\");"
138
139 #----------------------------------------------------------------
140 # Even the main thread is mortal - here it terminates "abruptly"
141 #----------------------------------------------------------------
142 Run 1 "OK" "Exception in thread \"main\".*Seppuku" "
143 final Thread mainThread = currentThread();
144 new Thread() { public void run() {
|
104 }
105 }
106
107 class NeverInvoked implements UncaughtExceptionHandler {
108 public void uncaughtException(Thread t, Throwable e) {
109 err.println("Test failure: This handler should never be invoked!");
110 }
111 }
112
113 public class Seppuku extends Thread implements Runnable {
114 public static void seppuku() { throw new RuntimeException("Seppuku!"); }
115
116 public void run() { seppuku(); }
117
118 public static void main(String[] args) throws Exception {
119 $mainBody
120 }
121 }
122 EOJAVA
123
124 Sys "$javac" "Seppuku.java"
125 CheckCommandResults "$expectedRC" "$expectedOut" "$expectedErr" \
126 "$java" "Seppuku"
127 Cleanup
128 }
129
130 #----------------------------------------------------------------
131 # A thread is never alive after you've join()ed it.
132 #----------------------------------------------------------------
133 Run 0 "OK" "Exception in thread \"Thread-0\".*Seppuku" "
134 Thread t = new Seppuku();
135 t.start(); t.join();
136 if (! t.isAlive())
137 out.println(\"OK\");"
138
139 #----------------------------------------------------------------
140 # Even the main thread is mortal - here it terminates "abruptly"
141 #----------------------------------------------------------------
142 Run 1 "OK" "Exception in thread \"main\".*Seppuku" "
143 final Thread mainThread = currentThread();
144 new Thread() { public void run() {
|