From f05ff996543d0239383d8b363fdbba15769c4aae Mon Sep 17 00:00:00 2001 From: Andrey Turbanov Date: Mon, 24 Jan 2022 11:10:16 +0000 Subject: [PATCH] 8280174: Possible NPE in Thread.dispatchUncaughtException Reviewed-by: alanb --- src/java.base/share/classes/java/lang/Thread.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/java.base/share/classes/java/lang/Thread.java b/src/java.base/share/classes/java/lang/Thread.java index 797a7f9f82e..77e0bbc6129 100644 --- a/src/java.base/share/classes/java/lang/Thread.java +++ b/src/java.base/share/classes/java/lang/Thread.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1976,8 +1976,8 @@ public class Thread implements Runnable { * @return the uncaught exception handler for this thread */ public UncaughtExceptionHandler getUncaughtExceptionHandler() { - return uncaughtExceptionHandler != null ? - uncaughtExceptionHandler : group; + UncaughtExceptionHandler handler = this.uncaughtExceptionHandler; + return handler != null ? handler : group; } /**