]
Stuart Douglas updated WFLY-4405:
---------------------------------
Component/s: (was: CDI / Weld)
NPE in AstValue.setValue()
--------------------------
Key: WFLY-4405
URL:
https://issues.jboss.org/browse/WFLY-4405
Project: WildFly
Issue Type: Bug
Components: 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.getType()}} 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.