From 5a2b2512c9f2480f5a8b792a7ff934045be7f288 Mon Sep 17 00:00:00 2001 From: jansupol Date: Tue, 5 Sep 2023 13:50:44 +0200 Subject: [PATCH] Prevent Class Cast Exception in cases where two classloaders handle the same TracingLogger Signed-off-by: jansupol --- .../glassfish/jersey/message/internal/TracingLogger.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core-common/src/main/java/org/glassfish/jersey/message/internal/TracingLogger.java b/core-common/src/main/java/org/glassfish/jersey/message/internal/TracingLogger.java index fd5b8d8d08..5105992db6 100644 --- a/core-common/src/main/java/org/glassfish/jersey/message/internal/TracingLogger.java +++ b/core-common/src/main/java/org/glassfish/jersey/message/internal/TracingLogger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2019 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -118,8 +118,8 @@ public static TracingLogger getInstance(final PropertiesDelegate propertiesDeleg //not server side return EMPTY; } - final TracingLogger tracingLogger = (TracingLogger) propertiesDelegate.getProperty(PROPERTY_NAME); - return (tracingLogger != null) ? tracingLogger : EMPTY; + final Object tracingLogger = propertiesDelegate.getProperty(PROPERTY_NAME); + return TracingLogger.class.isInstance(tracingLogger) ? (TracingLogger) tracingLogger : EMPTY; } /**