hmm looking at the code this is strange it should throw a nullpointer
exception
PropertyResolverConverter.convert(Object object, Class/*<?>*/ clz)
IConverter converter = converterSupplier.getConverter(clz);
if (object instanceof String)
{
return converter.convertToObject((String)object, locale);
}
else if (clz == String.class)
{
return converter.convertToString(object, locale);
}
else
{
try
{
return Objects.convertValue(object, clz);
}
catch (RuntimeException ex)
{
// ignore that try it the other way
}
// go through string to convert to the right object.
String tmp = converter.convertToString(object, locale);
return converter.convertToObject(tmp, locale);
}
i see that we don't even test for the converter for null...
johan
On 7/22/07, Martijn Dashorst <[EMAIL PROTECTED]> wrote:
I tried something that should throw an exception IMO.
public class Foo implements Serializable {}
public Index extends WebPage {
private Foo foo = null;
public Index() {
Form form = new Form("form");
form.add(new TextField("foo", new PropertyModel(this, "foo")));
}
}
<html>
<body>
<form wicket:id="form">
<input type="text" wicket:id="foo" />
<input type="submit" />
</form>
</body>
</html>
If you don't register a convertor for Foo, then this should result in
a ConversionException in my opinion, but the field will become null
instead without any error.
If this is desired behavior, then at least throw the exception in
development mode.
But I may be missing something important here (apart from the fact
that doing this is very stupid).
Martijn
--
Wicket joins the Apache Software Foundation as Apache Wicket
Apache Wicket 1.3.0-beta2 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta2/