From 3855c1ea50c2a87113ef43d9ff270c50abab37d4 Mon Sep 17 00:00:00 2001 From: Paul Nicolucci Date: Wed, 12 Jul 2023 06:39:48 -0400 Subject: [PATCH] MYFACES-4611: Avoid NPE when root is null --- .../org/apache/myfaces/view/facelets/ViewPoolProcessor.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/ViewPoolProcessor.java b/impl/src/main/java/org/apache/myfaces/view/facelets/ViewPoolProcessor.java index 49b7e31bbc..89e5a898a5 100644 --- a/impl/src/main/java/org/apache/myfaces/view/facelets/ViewPoolProcessor.java +++ b/impl/src/main/java/org/apache/myfaces/view/facelets/ViewPoolProcessor.java @@ -233,12 +233,13 @@ public ViewPool getViewPool(FacesContext context, UIViewRoot root) public boolean isViewPoolEnabledForThisView(FacesContext context, UIViewRoot root) { - if (root.isTransient()) + if (root == null || root.isTransient()) { // Stateless views cannot be pooled, because we are reusing // state saving algorithm for that. return false; } + Boolean enableViewPool = (Boolean) root.getAttributes().get(ViewPoolProcessor.ENABLE_VIEW_POOL); if (enableViewPool != null) { @@ -259,6 +260,7 @@ public boolean isViewPoolEnabledForThisView(FacesContext context, UIViewRoot roo return true; } } + return false; }