You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Bart Molenkamp <b....@bizzdesign.nl> on 2005/06/13 11:41:35 UTC

[CForms] Plain convertor for Enum datatype is null, throws NPE for MultiValueFields

Hi,

I have a multi-value field widget, with datatype enum (so that users can
select 0 or more values from an enum). But, when I load my object model
in the form (setting the enum values from my model into the formmodel),
then show the form, I get a NullPointerException in
MultiValueField.generateItemSaxFragment, line 135.

It tries to use the plain convertor from the Enum datatype. But this
plain convertor is null, because in the EnumTypeBuilder, line 80, it
tries to build the plain convertor:

plainConvertor = plainConvertorBuilder.build(null);

The builder is an EnumConvertorBuilder, which always returns null,
because the argument to build is always null:

public Convertor build(Element configElement) throws Exception {
  if (configElement == null) {
    return null;
  }

...

Is this correct, or is it a bug?

I think that the multi-value widget shouldn't use the plain convertor,
but the convertor defined in the datatype definition of the widget. That
contains the correct convertor widget. It could fall-back to the plain
convertor if the datatype's convertor is null.

Thanks,
Bart