Probably this:
https://issues.apache.org/jira/browse/TAPESTRY-1648

Cheers,
Nick.


Josh Penza wrote:
 I have build my own BigDecimalTranslator, because this translator was not
in the current Tapestry Release 5.0.5.

The textfield on my html page has a BigDecimalTranslator attached. But when
the textfield is empty and I submit the page it results in a
NullpointerException:

Coercion of null to type java.math.BigDecimal (via null --> String, String
--> java.math.BigDecimal) failed: *java.lang.NullPointerException
*
Below is the my BigDecimalTranslator Java class, it is almost the same as
other Translator Classes
These classes also return null when the clientValue is blank. But why do I
get a nullpointer then?



*public* *class* BigDecimalTranslator *implements* Translator<BigDecimal>

{

*private* NumberFormat nf = NumberFormat.*getInstance*(Locale.*GERMAN*);

/**

* Parses blank values to null, otherwise parses the client value to a
BigDecimal

*

* [EMAIL PROTECTED] ValidationException

* if the clientValue can not be parsed

*/

*public* BigDecimal parseClient(String clientValue, Messages messages) *
throws* ValidationException

{

*if* (InternalUtils.*isBlank*(clientValue)) {

*return* *null*;

}

*try
*

{

*return* *new* BigDecimal(nf.parse(clientValue.trim()).toString());

}

*catch* (NumberFormatException ex)

{

*throw* *new* ValidationException(messages.format("number-format-exception",
clientValue));

}

*catch* (ParseException ex)

{

*throw* *new* ValidationException(messages.format("number-parse-exception",
clientValue));

}

}

/**

* Converts null to the blank string, non-null to a string representation.

*/

*public* String toClient(BigDecimal value)

{

*return* value == *null* ? "" : nf.format(value).toString();

}

}


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to