[jboss-jira] [JBoss JIRA] (WFLY-4405) NPE in AstValue.setValue()

Christer Bernérus (JIRA) issues at jboss.org
Thu Mar 5 04:54:49 EST 2015


Christer Bernérus created WFLY-4405:
---------------------------------------

             Summary: NPE in AstValue.setValue()
                 Key: WFLY-4405
                 URL: https://issues.jboss.org/browse/WFLY-4405
             Project: WildFly
          Issue Type: Bug
          Components: CDI / Weld, JSF
    Affects Versions: 8.2.0.Final
         Environment: MacOS X, RHEL6
            Reporter: Christer Bernérus
            Assignee: Stuart Douglas


When submitting a page made up using a custom tag, or a composite component, WildFly reports NPE in AstValue.setValue().

The code where this happens is in javax.el-3.0.1-b05.jar and looks like this:

{code:title=AstValue.java|borderStyle=solid}
 /* Note by kchung 10/2013
         * The spec does not say if the value should be cocerced to the target
         * type before setting the value to the target. The conversion is kept
         * here to be backward compatible.
         */
        ctx.setPropertyResolved(false);
        Class<?> targetType = elResolver.getType(ctx, t.base, property);
        if (ctx.isPropertyResolved()) {
            ctx.setPropertyResolved(false);
            Object targetValue = elResolver.convertToType(ctx, value, targetType);

            if (ctx.isPropertyResolved()) {
                value = targetValue;
            } else {
                if (value != null || targetType.isPrimitive()) {
                    value = ELSupport.coerceToType(value, targetType);
                }
            }
        }
{code}

>From my debugging session, I have seen that the code in
{{elResolver.convertToType()}} may return null, which happens to me, 
but the subsequent code in {{AstValue.setValue()}} happily uses that null valued variable {{targetType}} for calling the method {{isPrimitive()}} which of course causes an NPE.

Strangely enough, this behaviour seems intermittent in that restarting WildFly might make the bug go away or come back, but redeployment does not.



--
This message was sent by Atlassian JIRA
(v6.3.11#6341)



More information about the jboss-jira mailing list