From 456c0b60ad23e3d73e4b5cbc6c1f6113fb792534 Mon Sep 17 00:00:00 2001 From: Bryce McKinlay Date: Mon, 12 Mar 2001 07:40:17 +0000 Subject: Runtime.java (_exit): Declare new package-private native. 2001-03-12 Bryce McKinlay * java/lang/Runtime.java (_exit): Declare new package-private native. * java/lang/natRuntime.cc (_exit): Implemented. Same as exit() but without a security manager check. (exit): Call _exit after security check. * prims.cc (JvRunMain): Call Runtime._exit to shutdown the runtime "naturally". * java/lang/System.java (setSecurityManager): If a security manager is already in place, call checkPermission. * java/lang/ThreadGroup.java (uncaughtException): If printStackTrace() throws an exception, try to deal with it gracefully. * java/lang/ExceptionInInitializerError.java (printStackTrace): Only try to print the subordinate stack trace if "exception" is set. Print our class name first. From-SVN: r40401 --- libjava/java/lang/ThreadGroup.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'libjava/java/lang/ThreadGroup.java') diff --git a/libjava/java/lang/ThreadGroup.java b/libjava/java/lang/ThreadGroup.java index e8b4446..bdf37f9 100644 --- a/libjava/java/lang/ThreadGroup.java +++ b/libjava/java/lang/ThreadGroup.java @@ -511,7 +511,19 @@ public class ThreadGroup { if (thread != null) System.out.print("Exception in thread \"" + thread.getName() + "\" "); - t.printStackTrace(); + try + { + t.printStackTrace(); + } + catch (Throwable x) + { + // This means that something is badly screwed up with the runtime, + // or perhaps someone is messing with the SecurityManager. In any + // case, try to deal with it gracefully. + System.out.println(t); + System.err.println("*** Got " + x.toString() + + " while trying to print stack trace"); + } had_uncaught_exception = true; } } -- cgit v1.1