From ed2548696d59a22bd5697413eeb1510166f2f595 Mon Sep 17 00:00:00 2001 From: jansupol Date: Tue, 2 Jan 2024 19:46:21 +0100 Subject: [PATCH] prevent NPE when WebAppException#getResponse returns null Signed-off-by: jansupol --- .../main/java/org/glassfish/jersey/server/ServerRuntime.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core-server/src/main/java/org/glassfish/jersey/server/ServerRuntime.java b/core-server/src/main/java/org/glassfish/jersey/server/ServerRuntime.java index 086bcda208..bae3a0e12d 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/ServerRuntime.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/ServerRuntime.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2024 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 @@ -526,7 +526,7 @@ private Response mapException(final Throwable originalThrowable) throws Throwabl processingContext.routingContext().setMappedThrowable(throwable); waeResponse = webApplicationException.getResponse(); - if (waeResponse.hasEntity()) { + if (waeResponse != null && waeResponse.hasEntity()) { LOGGER.log(Level.FINE, LocalizationMessages .EXCEPTION_MAPPING_WAE_ENTITY(waeResponse.getStatus()), throwable); return waeResponse;