Bug 52580 - javax.el.CompositeELResolver getValue throws NullPointerException
Summary: javax.el.CompositeELResolver getValue throws NullPointerException
Status: RESOLVED DUPLICATE of bug 50293
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Servlet & JSP API (show other bugs)
Version: 7.0.22
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-02 11:17 UTC by qiuyunzhong
Modified: 2012-02-05 19:18 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description qiuyunzhong 2012-02-02 11:17:58 UTC
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.
Comment 1 qiuyunzhong 2012-02-02 11:20:36 UTC
javax.el.CompositeELResolver resides in el-api.jar file. I use myfaces 1.2.9.
Comment 2 Mark Thomas 2012-02-05 19:18:05 UTC

*** This bug has been marked as a duplicate of bug 50293 ***