From dac70f4cb1aaac4c5cbf3a87b1e9e4aa54a3a9e0 Mon Sep 17 00:00:00 2001 From: Andrew Pielage Date: Wed, 13 Nov 2024 14:17:54 +0000 Subject: [PATCH] FISH-10136 Add fallout for if field doesn't exist Signed-off-by: Andrew Pielage --- .../org/glassfish/web/loader/WebappClassLoader.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/appserver/web/war-util/src/main/java/org/glassfish/web/loader/WebappClassLoader.java b/appserver/web/war-util/src/main/java/org/glassfish/web/loader/WebappClassLoader.java index d8e665518f9..898d2e45dd6 100644 --- a/appserver/web/war-util/src/main/java/org/glassfish/web/loader/WebappClassLoader.java +++ b/appserver/web/war-util/src/main/java/org/glassfish/web/loader/WebappClassLoader.java @@ -2673,8 +2673,16 @@ private void clearBeanELResolverCache() { private void clearBeanResolver(Class elUtilsClass) throws Exception { Optional> elResolverClass = Optional.ofNullable(CachingReflectionUtil .getClassFromCache("jakarta.el.BeanELResolver", this)); - Object resolver = CachingReflectionUtil.getFieldFromCache(elUtilsClass, "BEAN_RESOLVER", - false).get(null); + + Field field = CachingReflectionUtil.getFieldFromCache(elUtilsClass, "BEAN_RESOLVER", false); + if (field == null) { + logger.log(Level.FINE, "Could not find BEAN_RESOLVER field on {0}", elUtilsClass.getName()); + return; + } + + // TODO: Review whether this is still required; Mojarra may have fixed this themselves in PR#5479? + // Is there solution enough? Do we need to retain this for cases where another Faces implementation is being provided? + Object resolver = field.get(null); if (resolver != null && elResolverClass.isPresent()) { logger.fine(String.format("Fields: %s", Arrays.stream(elResolverClass.get().getDeclaredFields()) .map(Field::toString).collect(Collectors.toList())));