You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Ron Piterman (JIRA)" <ta...@jakarta.apache.org> on 2005/10/18 15:09:44 UTC
[jira] Created: (TAPESTRY-708) For component silently drop the value when unable to set
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
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: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org
[jira] Commented: (TAPESTRY-708) For component silently drop the value when unable to set
Posted by "Howard M. Lewis Ship (JIRA)" <ta...@jakarta.apache.org>.
[ 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: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org
[jira] Commented: (TAPESTRY-708) For component silently drop the value when unable to set
Posted by "Howard M. Lewis Ship (JIRA)" <ta...@jakarta.apache.org>.
[ http://issues.apache.org/jira/browse/TAPESTRY-708?page=comments#action_12356275 ]
Howard M. Lewis Ship commented on TAPESTRY-708:
-----------------------------------------------
Finally found a case that demonstrates your bug.
public abstract class ForValue extends BasePage
{
public Object[] getListValues()
{
return new Object[]
{ new Foo("zero"), new Foo("one"), new Bar("two"), new Foo("three") };
}
public abstract Foo getCurrent();
}
This seems to reproduce your bug; OGNL doesn't know how to convert from Bar to Foo and seems to be substituting null.
I need to check with Drew Davidson about what OGNL does when it can't do a conversion.
> 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: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org
[jira] Assigned: (TAPESTRY-708) For component silently drop the value when unable to set
Posted by "Howard M. Lewis Ship (JIRA)" <ta...@jakarta.apache.org>.
[ http://issues.apache.org/jira/browse/TAPESTRY-708?page=all ]
Howard M. Lewis Ship reassigned TAPESTRY-708:
---------------------------------------------
Assign To: Howard M. Lewis Ship
> 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: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org
[jira] Commented: (TAPESTRY-708) For component silently drop the value when unable to set
Posted by "Howard M. Lewis Ship (JIRA)" <ta...@jakarta.apache.org>.
[ http://issues.apache.org/jira/browse/TAPESTRY-708?page=comments#action_12356277 ]
Howard M. Lewis Ship commented on TAPESTRY-708:
-----------------------------------------------
We're getting to this code inside ExpressionEvaluatorImpl:
public void writeCompiled(Object target, Object expression, Object value)
{
try
{
Map context = createContext(target);
Ognl.setValue(expression, context, target, value);
}
catch (Exception ex)
{
throw new ApplicationRuntimeException(ImplMessages.unableToWriteExpression(ImplMessages
.parsedExpression(), target, value, ex), target, null, ex);
}
}
I think this is in OGNL's court; I've traced the code around and OGNL seems to be the one making the assignment to null.
> 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: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org
[jira] Resolved: (TAPESTRY-708) For component silently drop the
value when unable to set
Posted by "Jesse Kuhnert (JIRA)" <ta...@jakarta.apache.org>.
[ http://issues.apache.org/jira/browse/TAPESTRY-708?page=all ]
Jesse Kuhnert resolved TAPESTRY-708.
------------------------------------
Resolution: Won't Fix
Simply because it's an ognl bug. Not sure what we're supposed to do about it.
> For component silently drop the value when unable to set
> --------------------------------------------------------
>
> Key: TAPESTRY-708
> URL: http://issues.apache.org/jira/browse/TAPESTRY-708
> Project: Tapestry
> Issue Type: Bug
> Components: Framework
> Affects Versions: 4.0
> Reporter: Ron Piterman
> Assigned To: 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: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org