[
http://issues.apache.org/jira/browse/TAPESTRY-708?page=comments#action_12356274
]
Howard M. Lewis Ship commented on TAPESTRY-708:
-----------------------------------------------
I'm having trouble reproducing this, at least using beta-12.
I built a simple page that loops over a set of values and uses a For to stuff
each value into a property, which is then displayed.
<property name="index"/>
<component id="loop" type="For">
<binding name="source" value="listValues"/>
<binding name="value" value="current"/>
<binding name="index" value="index"/>
<binding name="element" value="literal:ul"/>
</component>
<ul jwcid="loop">
<li>
#<span jwcid="@Insert" value="ognl:index"/>:
<span jwcid="@Insert" value="ognl:current"/></li>
</ul>
public abstract class ForValue extends BasePage
{
public Object[] getListValues()
{
return new Object[]
{ 0, 1, 2, 3, 4, 5, 6 };
}
public abstract int getCurrent();
}
This works fine.
I change one of the values to a string and get a very complete exception.
java.lang.NumberFormatException
For input string: "some string"
Stack Trace:
*
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
* java.lang.Long.parseLong(Long.java:403)
* java.lang.Long.parseLong(Long.java:461)
* ognl.OgnlOps.longValue(OgnlOps.java:191)
* ognl.OgnlOps.convertValue(OgnlOps.java:357)
* ognl.DefaultTypeConverter.convertValue(DefaultTypeConverter.java:50)
* ognl.DefaultTypeConverter.convertValue(DefaultTypeConverter.java:55)
* ognl.OgnlRuntime.getConvertedType(OgnlRuntime.java:660)
* ognl.OgnlRuntime.getConvertedTypes(OgnlRuntime.java:676)
* ognl.OgnlRuntime.getConvertedMethodAndArgs(OgnlRuntime.java:699)
* ognl.OgnlRuntime.getAppropriateMethod(OgnlRuntime.java:756)
* ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:767)
* ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:937)
*
ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:76)
* ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:132)
* ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1629)
* ognl.ASTProperty.setValueBody(ASTProperty.java:105)
* ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
* ognl.SimpleNode.setValue(SimpleNode.java:246)
* ognl.Ognl.setValue(Ognl.java:476)
*
org.apache.tapestry.services.impl.ExpressionEvaluatorImpl.writeCompiled(ExpressionEvaluatorImpl.java:121)
*
$ExpressionEvaluator_1073cffdd93.writeCompiled($ExpressionEvaluator_1073cffdd93.java)
*
org.apache.tapestry.binding.ExpressionBinding.setObject(ExpressionBinding.java:172)
*
org.apache.tapestry.components.ForBean.updateOutputParameters(ForBean.java:198)
I then changed one of the values to be Long.MAX_VALUE.
I believe OGNL changed that value to -1.
Next, I tried a double value.
Something (OGNL?) trimmed the value from 3.14159 to just 3.
Using a new Date() instead gives a reasonable exception message:
java.lang.NumberFormatException
For input string: "Sat Oct 29 11:33:54 EDT 2005"
Stack Trace:
*
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
* java.lang.Long.parseLong(Long.java:403)
* java.lang.Long.parseLong(Long.java:461)
* ognl.OgnlOps.longValue(OgnlOps.java:191)
* ognl.OgnlOps.convertValue(OgnlOps.java:357)
* ognl.DefaultTypeConverter.convertValue(DefaultTypeConverter.java:50)
* ognl.DefaultTypeConverter.convertValue(DefaultTypeConverter.java:55)
* ognl.OgnlRuntime.getConvertedType(OgnlRuntime.java:660)
* ognl.OgnlRuntime.getConvertedTypes(OgnlRuntime.java:676)
* ognl.OgnlRuntime.getConvertedMethodAndArgs(OgnlRuntime.java:699)
* ognl.OgnlRuntime.getAppropriateMethod(OgnlRuntime.java:756)
* ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:767)
* ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:937)
*
ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:76)
* ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:132)
* ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1629)
* ognl.ASTProperty.setValueBody(ASTProperty.java:105)
* ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
* ognl.SimpleNode.setValue(SimpleNode.java:246)
* ognl.Ognl.setValue(Ognl.java:476)
*
org.apache.tapestry.services.impl.ExpressionEvaluatorImpl.writeCompiled(ExpressionEvaluatorImpl.java:121)
*
$ExpressionEvaluator_1073d032bd5.writeCompiled($ExpressionEvaluator_1073d032bd5.java)
*
org.apache.tapestry.binding.ExpressionBinding.setObject(ExpressionBinding.java:172)
*
org.apache.tapestry.components.ForBean.updateOutputParameters(ForBean.java:1
> For component silently drop the value when unable to set
> --------------------------------------------------------
>
> Key: TAPESTRY-708
> URL: http://issues.apache.org/jira/browse/TAPESTRY-708
> Project: Tapestry
> Type: Bug
> Components: Framework
> Versions: 4.0
> Reporter: Ron Piterman
> Assignee: Howard M. Lewis Ship
>
> When one defines:
> <span jwcid="@For" source="ognl:list" value="ognl:current">
> if the object in the list can not be assigned to the "current" property,
> because of unmatching types, setting will be silently fail.
> one *will* get a problem with a null value elsewhere, which is than very
> puzzling to try to solve.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]