commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Bartlett (JIRA)" <j...@apache.org>
Subject [jira] Created: (BEANUTILS-302) NPE in ArrayConverter when converting a non-quoted string with underscores to a string array
Date Wed, 30 Jan 2008 15:40:34 GMT
NPE in ArrayConverter when converting a non-quoted string with underscores to a string array
--------------------------------------------------------------------------------------------

                 Key: BEANUTILS-302
                 URL: https://issues.apache.org/jira/browse/BEANUTILS-302
             Project: Commons BeanUtils
          Issue Type: Bug
          Components: ConvertUtils & Converters
    Affects Versions: 1.8.0-BETA
         Environment: All
            Reporter: Martin Bartlett
             Fix For: 1.8.0-BETA


An array value passed as:

this_is_my_first_value,this_is_my_second_value

causes an NPE after the first token is returned:

java.lang.NullPointerException
	at org.apache.commons.beanutils.converters.ArrayConverter.parseElements(ArrayConverter.java:440)
	at org.apache.commons.beanutils.converters.ArrayConverter.convertToCollection(ArrayConverter.java:343)
	at org.apache.commons.beanutils.converters.ArrayConverter.convertToType(ArrayConverter.java:279)
	at org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:171)
	at org.apache.commons.beanutils.converters.ConverterFacade.convert(ConverterFacade.java:60)
	at org.apache.commons.beanutils.BeanUtilsBean.convert(BeanUtilsBean.java:1079)
	at org.apache.commons.beanutils.BeanUtilsBean.copyProperty(BeanUtilsBean.java:437)
	at org.apache.commons.beanutils.BeanUtilsBean.copyProperties(BeanUtilsBean.java:270)
	at org.apache.commons.beanutils.BeanUtils.copyProperties(BeanUtils.java:137)

The parse list being built contains "this". The sval field of the StreamTokenizer is indeed
null - presumably because it has found the the underscore.

Workaround is to quote the string. See BEANUTILS-301 for an improvement request to allow _
as part of the default word character set.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message