Description
When a TextField form element is bound to a numeric property (Double, Integer, aso) and no value is provided in the form (perfectly valid if the field is optional) the coercion code throws NullPointerException when trying to call new Double(null). The coercion code should check for null and not call the constructor with a null argument.
On the other hand, if this is considered normal behaviour, there should be a way to bind a TextField to a numeric property and to make it optional on the form.
Here follows a test case illustrating the problem:
DoubleCoercionTest.html:
------------------------------------
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<body>
<form t:type="Form">
<p><input t:type="TextField" t:value="doubleTest" size="40"/>
<input t:type="Submit"/></p>
</form>
</body>
</html>
DoubleCoercionTest.java:
-----------------------------------
import org.apache.tapestry.annotations.Persist;
public class DoubleCoercionTest
{
@Persist
private Double doubleTest;
public Double getDoubleTest()
public void setDoubleTest(Double doubleTest)
{this.doubleTest = doubleTest;}}