From 43bb9d215a6e54d3836e19cae1a7f28bae85d474 Mon Sep 17 00:00:00 2001 From: Jeremy Grelle Date: Tue, 14 Oct 2008 14:30:21 +0000 Subject: [PATCH] SWF-890 - RichFacesAjaxHandler does not correctly deal with FacesContext.getCurrentInstance() being null --- .../springframework/faces/richfaces/RichFacesAjaxHandler.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spring-faces/src/main/java/org/springframework/faces/richfaces/RichFacesAjaxHandler.java b/spring-faces/src/main/java/org/springframework/faces/richfaces/RichFacesAjaxHandler.java index 68d2d036..455fe3b4 100644 --- a/spring-faces/src/main/java/org/springframework/faces/richfaces/RichFacesAjaxHandler.java +++ b/spring-faces/src/main/java/org/springframework/faces/richfaces/RichFacesAjaxHandler.java @@ -28,6 +28,7 @@ import org.ajax4jsf.context.AjaxContext; import org.springframework.faces.webflow.FlowLifecycle; import org.springframework.js.ajax.AjaxHandler; import org.springframework.js.ajax.SpringJavascriptAjaxHandler; +import org.springframework.util.Assert; import org.springframework.web.context.support.WebApplicationObjectSupport; /** @@ -80,11 +81,12 @@ public class RichFacesAjaxHandler extends WebApplicationObjectSupport implements if (FacesContext.getCurrentInstance() != null) { return FacesContext.getCurrentInstance(); } else { - created = true; FacesContextFactory facesContextFactory = (FacesContextFactory) FactoryFinder .getFactory(FactoryFinder.FACES_CONTEXT_FACTORY); FacesContext defaultFacesContext = facesContextFactory.getFacesContext(context, request, response, FlowLifecycle.newInstance()); + Assert.notNull(defaultFacesContext, "Creation of the default FacesContext failed."); + created = true; return defaultFacesContext; } }