You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Gabriel Borges <ga...@tjmg.gov.br> on 2006/09/12 13:36:20 UTC

Problems with LazyValidatorForm and BeanUtils.copyProperties

Hi,

I am having some trouble when I use a LazyValidatorForm with BeansUtils.copyProperties.

When I am doing the transfer from a LazyValidatorForm to a (my) Bean, BeanUtils.copyProperties(appModel, (LazyValidatorForm) form); 

The copyProperties method is trying to set a value "Object" to a Set.

I think there is a bug in the method "get(String name)" of the class org.apache.commons.beanutils.LazyDynaBean

See bellow my questions.


Anybody agree with me?

public Object get(String name) {


        if (name == null) {

                throw new IllegalArgumentException("No property name specified");

        }


        // Value found

        Object value = values.get(name);

        if (value != null) {

                return value;

        }


        // Property doesn't exist

         // HERE i THINK THAT IF IS A DYNAPROPERTY, IT SHOULD RETURN NULL, I THINK THE SIMBOL "!" SHOULD NOT BE HERE

        if (!isDynaProperty(name)) {

                return null;

        }


        // Property doesn't exist

      // SO IF THE PROPERTY DOESN'T EXIST, CREATE IT. JUST AS ABOVE

        value = createProperty(name, dynaClass.getDynaProperty(name).getType());


        if (value != null) {

                set(name, value);

        }


        return value;


}

Thanks a lot...

Gabriel Borges