[seam-issues] [JBoss JIRA] (SEAMFACES-245) SecurityPhaseListener throwing NullPointerException if could not find faces resource

Lucas Ventura Carro (JIRA) jira-events at lists.jboss.org
Thu Apr 12 06:48:47 EDT 2012


    [ https://issues.jboss.org/browse/SEAMFACES-245?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12683361#comment-12683361 ] 

Lucas Ventura Carro edited comment on SEAMFACES-245 at 4/12/12 6:48 AM:
------------------------------------------------------------------------

[Here|https://community.jboss.org/thread/179011] is a post about this error. But Jason's response doesn't helps. Also is not solved in newer release.

I did possible workaround.
* exclude the bean adding in your {{beans.xml}}:
{code:xml}<weld:exclude pattern="org.jboss.seam.faces.security.SecurityPhaseListener" />{code}
* create a new class extending {{org.jboss.seam.faces.security.SecurityPhaseListener}}, like this:
{code:java}
public class AvoidNullSecurityPhaseListener extends SecurityPhaseListener {

	@Override
	public void observeRestoreView(@Observes @After @RestoreView PhaseEvent event) {
		if (event.getFacesContext().getViewRoot() == null)
			return;

		super.observeRestoreView(event);
	}

}
{code}
I think this is safe, because if view doesn't exist, should not have any security restriction.
                
      was (Author: lucasvc):
    [Here|https://community.jboss.org/thread/179011] is a post about this error. But Jason's response doesn't helps. Also is not solved in newer release.

A possible workaround, but not tryed (therorically could work): exclude the bean {{org.jboss.seam.faces.security.SecurityPhaseListener}} using {{beans.xml}}, create a new class extending it, but override the method {{performObservation}} testing if viewRoot is not {{null}}.
                  
> SecurityPhaseListener throwing NullPointerException if could not find faces resource
> ------------------------------------------------------------------------------------
>
>                 Key: SEAMFACES-245
>                 URL: https://issues.jboss.org/browse/SEAMFACES-245
>             Project: Seam Faces
>          Issue Type: Bug
>          Components: View Configuration
>    Affects Versions: 3.1.0.Tracking
>         Environment: Tomcat 6, Windows 7 x64
>            Reporter: Lucas Ventura Carro
>
> After a {{com.sun.faces.context.FacesFileNotFoundException}} thrown, the class {{org.jboss.seam.faces.security.SecurityPhaseListener}} when recieved the event phase {{@RestoreView}} in {{@After}}, the view root is {{null}}, so trying to get its id is throwing {{NullPointerException}}.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the seam-issues mailing list