Code in a unit test:

  DyanActionForm form = new DynaActionForm();
  BeanUtils.copyProperties(bean, form);

This results in a NullPointerException when BeanUtils calls form.getDynaClass().getProperties() (or something like that).

BeanUtils is expecting dynaClass to be set, but DynaActionFrom gives me no way to set it, unless I create a sub-class. I had to single step through the BeanUtils code to figure out what was causing the NPE (complicated by the fact that BeanUtils 1.7.0 has an incorrect version listed in it's manifest :=( ).

DynaActionFrom should probably either be abstract or provide a setter for dynaClass, given that it's currently impossible to create a valid instance without sub-classing.

I'll file a bug report against BeanUtils to use guards around uses of getDynaClass() if we can't agree a way to ensure it's unnessesary. Can Struts do one of the following:

- make DynaActionForm abstract
- make the default constuctor require an initialization value for dynaClass

I'm guessing the answer is no (for backwards compatibility reasons, although maybe not if a DynaActionFrom w/out dynaClass set is always invalid). In that case BeanUtils will need to be fixed.

Ugly way to spend an evening, this :-)

L.


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

Reply via email to