[jira] Created: (BEANUTILS-302) NPE in ArrayConverter when converting a non-quoted string with underscores to a string array

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (BEANUTILS-302) NPE in ArrayConverter when converting a non-quoted string with underscores to a string array

JIRA jira@apache.org
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.

Reply | Threaded
Open this post in threaded view
|

[jira] Resolved: (BEANUTILS-302) NPE in ArrayConverter when converting a non-quoted string with underscores to a string array

JIRA jira@apache.org

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

Niall Pemberton resolved BEANUTILS-302.
---------------------------------------

       Resolution: Fixed
    Fix Version/s:     (was: 1.8.0-BETA)
                   1.8.0
         Assignee: Niall Pemberton

Thanks for reporting this, now fixed:
    http://svn.apache.org/viewvc?view=rev&revision=618207



> 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
>            Assignee: Niall Pemberton
>             Fix For: 1.8.0
>
>
> 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.