myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthias We├čendorf (JIRA) <...@myfaces.apache.org>
Subject [jira] Resolved: (MYFACES-1392) NullPointerException in SessionMap.setAttribute
Date Sat, 26 Aug 2006 06:44:26 GMT
     [ 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

       

Mime
View raw message