Hi,
I've got a BeanForm in my Tapestry 5.0.9 Application, with the Bean
expecting some Integers as input. When I submit the form without
entering any data in these fields, I get an RuntimeException in the
TypeCoercerImpl (line 130), because while converting my void to Integer
it uses void --> String --> Long --> Integer, and comes accross a
NullPointerException in the constructor for a Long(String).
It seems the TypeCoercerImpl.findOrCreateCoercion(...) method preferes
this Coercion to the COERCION_NULL_TO_OBJECT, which in my case would
have suited me better.
To overcome this, I added a few lines in TypeCoercerImpl.coerce(...) at
line 130
<pre>
try
{
result = coercion.coerce(input);
}
catch (Exception ex)
{
if (input == null)
{
try
{
result = COERCION_NULL_TO_OBJECT.coerce(input);
}
catch (Throwable t)
{
throw new
RuntimeException(ServiceMessages.failedCoercion(
input,
targetType,
coercion,
ex), ex);
}
}
else
throw new RuntimeException(ServiceMessages.failedCoercion(
input,
targetType,
coercion,
ex), ex);
}
</pre>
Not sure about the side-effects of this workaround, but I thought I'd
post it, as it might be a bug.
Greetings,
M.C.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]