https://issues.apache.org/bugzilla/show_bug.cgi?id=52580

             Bug #: 52580
           Summary: javax.el.CompositeELResolver getValue throws
                    NullPointerException
           Product: Tomcat 7
           Version: 7.0.22
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Servlet & JSP API
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: qiuyunzh...@hotmail.com
    Classification: Unclassified


I think this issue has the same root cause of bug
50293(javax.el.CompositeELResolver synchronization issue).
When CompositeELResolver.getValue was called, sometimes it raised
NullPointerException. Here is the stacktrace:

Caused by: java.lang.NullPointerException
        at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:67)
        at
org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:142)
        at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:67)
        at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:71)
        at org.apache.el.parser.AstValue.getValue(AstValue.java:147)
        at
org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189)
        at
org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:985)
        at jsp.portal.portal_jsp._jspService(portal_jsp.java:143)
The source code of javax.el.CompositeELResolver.getValue():
 @Override
    public Object getValue(ELContext context, Object base, Object property)
            throws NullPointerException, PropertyNotFoundException, ELException
{
        context.setPropertyResolved(false);
        int sz = this.size;
        Object result = null;
        for (int i = 0; i < sz; i++) {
            result = this.resolvers[i].getValue(context, base, property);--line
67
            if (context.isPropertyResolved()) {
                return result;
            }
        }
        return null;
    }
Source code of
org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue is:
    @Override
    public Object getValue(final ELContext context, final Object base, final
Object property)-131
    {
        final FacesContext facesContext =
FacesContext.getCurrentInstance();-133
        if (facesContext == null)
        {
            return null;
        }
        final Map<String, Object> requestMap =
facesContext.getExternalContext().getRequestMap();
        try
        {
            setScope(requestMap);
            return super.getValue(context, base, property); -line 142
        }
        finally
        {
            unsetScope(requestMap);
        }
    }
It seems the resolvers[i] has been set to null yet. I don't visit the page
concurrently, however, this exception still raise and it makes the page 500
error. 
Do we plan to fix this issue by add synchronize check or just as 50923's
comment that from ELResolver spec it's not thread safe? This issue makes page
unstable sometime and only restart tomcat to recover.
Thanks a lot.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to