Re: [solved] Getting Exception rarerly with my website askkuber.com

Splash Forums PrettyFaces Users [solved] Getting Exception rarerly with my website askkuber.com Re: [solved] Getting Exception rarerly with my website askkuber.com

#19926

geert3
Participant

After some more digging in the sources of PrettyFaces, and knowing what i know from the previous post, I wound up in your class FacesContextBuilder:

public FacesContext getFacesContext(final ServletRequest request, final ServletResponse response)

{

FacesContext facesContext = FacesContext.getCurrentInstance();

if (facesContext != null)

{

return facesContext;

}

… create new facescontext …

}

You’re returning the existing facescontext when it exists. But this existing facescontext may link to an incorrect/obsolete request, at least facesContext.getExternalContext().getRequest() is different from the parameter “request”. Shouldn’t you in that case create a new facescontext as well?

In any case ((HttpServletRequest)

(facesContext.getExternalContext().getRequest()).getSession() is null at this point which is causing the NPE.

regards

Geert