commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stian Soiland-Reyes (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (BEANUTILS-493) Exception when setting indexed properties: "Default conversion to ArrayList failed"
Date Wed, 14 Sep 2016 11:58:21 GMT

     [ https://issues.apache.org/jira/browse/BEANUTILS-493?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Stian Soiland-Reyes updated BEANUTILS-493:
------------------------------------------
    Fix Version/s: 1.9.3

> Exception when setting indexed properties: "Default conversion to ArrayList failed"
> -----------------------------------------------------------------------------------
>
>                 Key: BEANUTILS-493
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-493
>             Project: Commons BeanUtils
>          Issue Type: Bug
>          Components: Bean / Property Utils, DynaBean
>    Affects Versions: 1.9.2, 1.9.3
>         Environment: commons-beanutils-1.9.3-20160606.150953-11
> jdk1.8.0_92
>            Reporter: Bernhard Seebass
>            Priority: Blocker
>              Labels: regression
>             Fix For: 1.9.3
>
>         Attachments: BeanUtilsBean.java.patch, BeanUtilsBeanTest.java
>
>
> An exception is thrown when adding indexed properties to a DynaBean. This worked perfectly
with Version 1.8.3
> org.apache.commons.beanutils.ConversionException: Default conversion to ArrayList failed.
> 	at org.apache.commons.beanutils.converters.AbstractConverter.handleMissing(AbstractConverter.java:314)
> 	at org.apache.commons.beanutils.converters.AbstractConverter.handleError(AbstractConverter.java:269)
> 	at org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:177)
> 	at org.apache.commons.beanutils.converters.ConverterFacade.convert(ConverterFacade.java:61)
> 	at org.apache.commons.beanutils.ConvertUtilsBean.convert(ConvertUtilsBean.java:491)
> 	at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1004)
> 	at BeanUtilsBeanTestApp.main(BeanUtilsBeanTestApp.java:11)
> Caused by: org.apache.commons.beanutils.ConversionException: Can't convert value '' to
type class java.util.ArrayList
> 	at org.apache.commons.beanutils.converters.AbstractConverter.conversionException(AbstractConverter.java:474)
> 	at org.apache.commons.beanutils.converters.StringConverter.convertToType(StringConverter.java:96)
> 	at org.apache.commons.beanutils.converters.AbstractConverter.handleMissing(AbstractConverter.java:312)
> 	... 6 more
> Test Class:
> import org.apache.commons.beanutils.BeanUtilsBean;
> import org.apache.commons.beanutils.LazyDynaBean;
> public class BeanUtilsBeanTestApp {
> 	
> 	public static void main(String[] args) {
> 		try {
> 			LazyDynaBean lazyDynaBean = new LazyDynaBean();
> 			BeanUtilsBean beanUtilsBean = BeanUtilsBean.getInstance();
> 			beanUtilsBean.setProperty(lazyDynaBean, "x[0]", "x1");
> 			beanUtilsBean.setProperty(lazyDynaBean, "x[1]", "x2");
> 			System.out.println(lazyDynaBean.get("x")); // output using commons-beanutils 1.8.3:
[x1, x2]
> 		} catch (Exception e) {
> 			e.printStackTrace();
> 		}
> 	}
> }



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message