Immediate EL expressions not resolved correctly
-----------------------------------------------
Key: MYFACES-1697
URL: https://issues.apache.org/jira/browse/MYFACES-1697
Project: MyFaces Core
Issue Type: Bug
Components: JSR-252
Affects Versions: 1.2.0
Environment: This is happening to me on a project that uses MyFaces
1.2.0, Servlets API 2.5, Tiles 2.0.4, Hibernate 3.2.0, Tomcat 6. I have only
recently upgraded to MyFaces 1.2.0 and the new Servlep API. OS is Windows.
Reporter: Paul Dermody
Recently I tried to start using immediate JSP EL expressions but I am getting
an odd behaviour which I would like to know if anyone else has seen.
In my mfaces-config.xml I have the following Managed bean defined:
<managed-bean>
<managed-bean-name>myDate</managed-bean-name>
<managed-bean-class>java.util.Date</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
I have a JSP that contains the following:
<f:view>
<h:panelGrid columns="1">
<h:outputText value="myDate=#{myDate}" />
<h:outputText value="myDate.time=#{myDate.time} " />
<f:verbatim>
myDate = ${myDate}<br>
myDate.time = ${myDate.time}
</f:verbatim>
</h:panelGrid>
</f:view>
The output I am getting for this code is as follows:
myDate=Fri Aug 03 11:52:31 CST 2007
myDate.time=1186163551316
myDate = Fri Aug 03 11:52:31 CST 2007
myDate.time =
This behaviour is clearly wrong. For some reason the immediate EL expression is
not resolving the time property correctly.
I debugged this in Eclipse and I found that the "time" segment of the EL
expression is being resolved to 'null' via a sequence of calls that eventually
leads to the following stack trace:
date.jsp line: 10
org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(String,
Class, javax.servlet.jsp.PageContext,
org.apache.jasper.runtime.ProtectedFunctionMapper, boolean) line: 923
org.apache.el.ValueExpressionImpl.getValue(javax.el.ELContext) line: 186
org.apache.el.parser.AstValue.getValue(org.apache.el.lang.EvaluationContext)
line: 97
javax.el.CompositeELResolver.getValue( javax.el.ELContext, Object, Object)
line: 53
org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(javax.el.ELContext,
Object, Object) line: 104
org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.invoke
(org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.ResolverInvoker<T>)
line: 148
org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver$4.invoke()
line: 108
org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.access$301
(org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver,
javax.el.ELContext, Object, Object) line: 46
org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver(javax.el.CompositeELResolver).getValue(
javax.el.ELContext, Object, Object) line: 53
org.apache.myfaces.el.convert.PropertyResolverToELResolver.getValue(javax.el.ELContext,
Object, Object) line: 106
org.apache.myfaces.el.convert.PropertyResolverToELResolver.invoke
(javax.el.ELContext, Object, Object,
org.apache.myfaces.el.convert.PropertyResolverToELResolver.ResolverInvoker<T>)
line: 193
org.apache.myfaces.el.convert.PropertyResolverToELResolver$3.invoke(Object,
Object) line: 115
org.apache.myfaces.el.DefaultPropertyResolver.getValue(Object, Object)
line: 64
The source of the deepest function is as follows:
public Object getValue(Object base, Object property) throws
EvaluationException, PropertyNotFoundException
{
updatePropertyResolved();
return null;
}
The updatePropertyResolved() function looks like this:
private void updatePropertyResolved()
{
FacesContext.getCurrentInstance().getELContext().setPropertyResolved(false);
}
This function is setting the propertyResolved flag to false in the "current"
ELContext. This is necessary since the propertyResolved flag is set to true
before every call to each resolver. The current ELContext is of type
org.apache.myfaces.el.unified.FacesELContext and eclipse says it's id is 313.
However, when I look further up the stack it turns out that the
FacesCompositeELResolver checks to see if the "time" segment was resolved by
checking the value of the propertyResolved flag in a context object of type
org.apache.el.lang.EvaluationContext with id 266. Confusingly, this context
object delegates it's work to a different context object of type
org.apache.jasper.el.ELContextImpl with id 259. The point here is that it seems
to me that the wrong context object is being used somewhere - the
propertyResolved flag is being set in one object but check in a different
object!!
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.