Re: NullPointerException in ScopedAttributeELResolver.setValue(…
Splash › Forums › PrettyFaces Users › NullPointerException in ScopedAttributeELResolver.setValue(… › Re: NullPointerException in ScopedAttributeELResolver.setValue(…
I had another look at this issue. First of all: I think it is a Mojarra bug. In my opinion neither Primefaces nor PrettyFaces are responsible for this. Let me try to explain the technical details.
p:graphicText loads the image by creating a second request to the same URL with a few additional query parameters. Primefaces intercepts this request before RESTORE_VIEW phase, writes the image to the response stream and calls
FacesContext.responseComplete(). Somehow this prevents that Mojarra creates a
UIViewRoot for this request.
After that the PrettyFaces
PrettyPhaseLister gets executed and processes the path parameters and writes the value to the EL context. This is handled by Mojarra’s
ScopedAttributeELResolver which checks if the attribute is available in any scope. During this check Mojarra calls
facesContext.getViewRoot().getViewMap(). This line throws the
NullPointerException cause there is no
UIViewRoot for the request.
I hope that my explanation is correct. You see that the issue is a bit complex! But I think it is definitively a Mojarra bug.
You can work around this issue by injecting the path parameter directly into the target bean. I hope this workaround is OK for you.