diff options
Diffstat (limited to 'java/lang/Thread.java')
-rw-r--r-- | java/lang/Thread.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/java/lang/Thread.java b/java/lang/Thread.java index 99c8381aa..55d134fe6 100644 --- a/java/lang/Thread.java +++ b/java/lang/Thread.java @@ -1065,7 +1065,9 @@ public class Thread implements Runnable * <li>If this thread has its own handler, this is returned.</li> * <li>If not, then the handler of the thread's <code>ThreadGroup</code> * object is returned.</li> - * <li>If both are unavailable, then <code>null</code> is returned.</li> + * <li>If both are unavailable, then <code>null</code> is returned + * (which can only happen when the thread was terminated since + * then it won't have an associated thread group anymore).</li> * </ul> * * @return the appropriate <code>UncaughtExceptionHandler</code> or @@ -1074,7 +1076,7 @@ public class Thread implements Runnable */ public UncaughtExceptionHandler getUncaughtExceptionHandler() { - return exceptionHandler; + return exceptionHandler != null ? exceptionHandler : group; } /** |