commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niall Pemberton (JIRA)" <j...@apache.org>
Subject [jira] Commented: (BEANUTILS-368) NullPointerException in BeanUtilsBean .setProperty(), line: 930
Date Thu, 12 Nov 2009 23:36:39 GMT

    [ https://issues.apache.org/jira/browse/BEANUTILS-368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12777275#action_12777275
] 

Niall Pemberton commented on BEANUTILS-368:
-------------------------------------------

BeanUtils 1.8.2 has been released which fixes this - should be available in the next 24hrs
(takes time for all the mirrors to sync up)

http://commons.apache.org/beanutils/download_beanutils.cgi

> NullPointerException in BeanUtilsBean .setProperty(), line: 930
> ---------------------------------------------------------------
>
>                 Key: BEANUTILS-368
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-368
>             Project: Commons BeanUtils
>          Issue Type: Bug
>          Components: Bean / Property Utils
>    Affects Versions: 1.8.1
>         Environment: JDK 1.6
>            Reporter: Peter Fassev
>            Assignee: Niall Pemberton
>            Priority: Critical
>             Fix For: 1.8.2
>
>
> There is a NullPointerException in the method BeanUtilsBeans.setProperty(Object bean,
String name, Object value) method:
> java.lang.NullPointerException
> 	at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:930)
> The problem is, that few rows earlear the target may be null:
>                 target = getPropertyUtils().getProperty(target, resolver.next(name));
// NOTE, the result may be NULL.
> In such case, the condition at line 930
>         } else if (target.getClass().isArray() && index >= 0) {
> will race a NullPointerException. In the old 1.7.0 version there has been no such condition
or has been executed later...
> Proposed FIX: Please add at new line, which checks the "target" 
>         target = getPropertyUtils().getProperty(target, resolver.next(name)); // NOTE,
the result may be NULL.
>         if (target == null) {
>             return;
>         }
> NOTE. Such check may be added also to the other similar methods, like BeanUtilsBean.copyProperty().
> Regards
> Peter

-- 
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