You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Matthias Weßendorf (JIRA)" <de...@myfaces.apache.org> on 2006/08/26 08:44:26 UTC

[jira] Resolved: (MYFACES-1392) NullPointerException in SessionMap.setAttribute

     [ http://issues.apache.org/jira/browse/MYFACES-1392?page=all ]

Matthias Weßendorf resolved MYFACES-1392.
-----------------------------------------

    Resolution: Won't Fix

could not reprocude

provide test case

> NullPointerException in SessionMap.setAttribute
> -----------------------------------------------
>
>                 Key: MYFACES-1392
>                 URL: http://issues.apache.org/jira/browse/MYFACES-1392
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: General
>    Affects Versions: 1.1.3
>            Reporter: Mads Peter Henderson
>
> I frequently - but far from always get a NPE when I use the variable resolver to resolve a session scope variable. Does anyone have any idea of what I am doing wrong?
> The setup is this.
> I have set up a session scope backing bean let's call it my myBean.
> I have a servlet that generates graphic elements for some pages based on the information in myBean.
> In the servlet I do the following:
>     FacesContext facesContext = FacesContext.getCurrentInstance();
>     if (facesContext == null) {
>       FacesContextFactory fcf =
>         (FacesContextFactory) FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
>       LifecycleFactory lifecycleFactory =
>         (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
>       facesContext = fcf.getFacesContext(getServletContext(),
>         req,
>         resp,
>         lifecycleFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE ));
>     }
>     if (facesContext != null) {
>       VariableResolver vr = facesContext.getApplication().getVariableResolver();
>       if (vr != null) {
>         Object o = vr.resolveVariable(facesContext, "myBean");
>       }
>     }
> As I started to say the line:
> vr.resolveVariable(facesContext, "myBean");
> somtimes throw a NPE with the following trace:
> java.lang.NullPointerException
>         at
> org.apache.myfaces.context.servlet.SessionMap.setAttribute(SessionMap.java:50)
>         at
> org.apache.myfaces.context.servlet.AbstractAttributeMap.put(AbstractAttributeMap.java:104)
>         at
> org.apache.myfaces.el.VariableResolverImpl$13.put(VariableResolverImpl.java:192)
>         at
> org.apache.myfaces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:328)
>         at
> org.apache.myfaces.config.LastVariableResolverInChain.resolveVariable(LastVariableResolverInChain.java:42)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira