From 086db59c3be230920a824119392628790565b272 Mon Sep 17 00:00:00 2001 From: "Keith W. Campbell" Date: Thu, 9 Nov 2023 13:11:38 -0500 Subject: [PATCH] Tolerate null in getLoaderNameID() * 8319436: Proxy.newProxyInstance throws NPE if loader is null and interface not visible from class loader Signed-off-by: Keith W. Campbell --- jcl/src/java.base/share/classes/java/lang/Access.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jcl/src/java.base/share/classes/java/lang/Access.java b/jcl/src/java.base/share/classes/java/lang/Access.java index 8bbe07b0d28..d9f31f29004 100644 --- a/jcl/src/java.base/share/classes/java/lang/Access.java +++ b/jcl/src/java.base/share/classes/java/lang/Access.java @@ -720,6 +720,9 @@ public void setCarrierThreadLocal(CarrierThreadLocal carrierThreadlocal, /*[IF JAVA_SPEC_VERSION >= 11]*/ @Override public String getLoaderNameID(ClassLoader loader) { + if (loader == null) { + return "null"; + } StringBuilder buffer = new StringBuilder(); String name = loader.getName();