Revert "Prevent NPE in Mojarra when creating initial view"

This reverts commit d31900e5f9.

The fix for SWF-1571 reported against Mojarra 2.1.8 seems to be
problematic when Web Flow's ResponseStateManager is not used as
reported in SWF-1630.

Testing with Mojarra 2.1.20 I can no longer reproduce SWF-1571
and originally it was suspected to be a Mojarra issue. Hence
this revert.

Issue: SWF-1571, SWF-1630
This commit is contained in:
Rossen Stoyanchev
2014-05-20 16:19:14 -04:00
parent 8680d09fbc
commit 1c67a0dc08
3 changed files with 1 additions and 27 deletions

View File

@@ -142,13 +142,4 @@ public class FlowResponseStateManager extends ResponseStateManagerWrapper {
writer.endElement("input");
}
}
/**
* Determine if the request context has existing state.
* @param context the request context
* @return {@code true} if the context has state
*/
static boolean hasState(RequestContext context) {
return (context != null) && (context.getViewScope().contains(FACES_VIEW_STATE));
}
}

View File

@@ -132,12 +132,7 @@ public class JsfViewFactory implements ViewFactory {
private UIViewRoot getViewStateViewRoot(RequestContext context, FacesContext facesContext, ViewHandler viewHandler,
String viewName) {
UIViewRoot viewRoot = null;
if (FlowResponseStateManager.hasState(context)) {
// Only try an initial restore if we have state (see SWF-1571)
viewRoot = viewHandler.restoreView(facesContext, viewName);
}
UIViewRoot viewRoot = viewHandler.restoreView(facesContext, viewName);
if (viewRoot != null) {
if (logger.isDebugEnabled()) {
logger.debug("UIViewRoot restored for '" + viewName + "'");
@@ -149,7 +144,6 @@ public class JsfViewFactory implements ViewFactory {
}
viewRoot = viewHandler.createView(facesContext, viewName);
}
return viewRoot;
}