tt0686
tt0686

Reputation: 1849

BeanUtils.setProperty throws exception with value NULL

I am using org.apache.commons.beanutils.BeanUtils.setProperty(bean,name,value). When the value is NULL it throws an exception . Digging inside class what is causing the exception is the ConverterUtilsBean.convert method more specifically the BigDecimalConverter.convert that does not accept null. How can i overcome this issue ?

Thanks in advance. Best regards.

Upvotes: 0

Views: 563

Answers (1)

Anthony Bongungu
Anthony Bongungu

Reputation: 1

ConvertUtilsBean convertUtilsBean = BeanUtilsBean.getInstance().getConvertUtils();
convertUtilsBean.register(false, true, -1);

BeanUtils Copy Properties: Registering ConvertUtils

check this thread out!

Upvotes: 0

Related Questions