You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by David Morris <Da...@plumcreek.com> on 2003/01/03 21:55:54 UTC
Bean Utils patch for beta 1.3
One of the errors I found in Beta 1.3 was caused when a null source
value is passed to the BeanUtils class. The target value should be set
to null in this case but it isn't because of a recent change. Here is a
patch. Whoever applies this might want to look at this in context and
check for null before attempting conversion.
David Morris
Index: BeanUtils.java
===================================================================
RCS file:
/home/cvspublic/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/BeanUtils.java,v
retrieving revision 1.32
diff -u -r1.32 BeanUtils.java
--- BeanUtils.java 21 Dec 2002 19:33:19 -0000 1.32
+++ BeanUtils.java 3 Jan 2003 20:52:43 -0000
@@ -905,7 +905,7 @@
} else if (value instanceof String[]) {
newValue = ConvertUtils.convert(((String[]) value)[0],
type);
- } else if (ConvertUtils.lookup(value.getClass()) != null) {
+ } else if (value != null &&
ConvertUtils.lookup(value.getClass()) != null) {
newValue = ConvertUtils.convert(value.toString(),
type);
} else {
newValue = value;
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Bean Utils patch for beta 1.3
Posted by "Craig R. McClanahan" <cr...@apache.org>.
On Fri, 3 Jan 2003, David Morris wrote:
> Date: Fri, 03 Jan 2003 13:55:54 -0700
> From: David Morris <Da...@plumcreek.com>
> Reply-To: Struts Developers List <st...@jakarta.apache.org>
> To: struts-dev@jakarta.apache.org
> Subject: Bean Utils patch for beta 1.3
>
> One of the errors I found in Beta 1.3 was caused when a null source
> value is passed to the BeanUtils class. The target value should be set
> to null in this case but it isn't because of a recent change. Here is a
> patch. Whoever applies this might want to look at this in context and
> check for null before attempting conversion.
>
This bug was reported against beanutils directly:
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15773
and I just checked in a fix for it (more comprehensive than your fix below
because there were a couple of other failure scenarios as well). Could
you download tonight's (20030104) commons-beanutils distro and replace
commons-beanutils.jar to see if it fixes the problem for you?
http://jakarta.apache.org/builds/jakarta-commons/nightly/commons-beanutils
If it does, we'll probably need to post a note on the download page with a
pointer to the replacement library.
Craig
> David Morris
>
> Index: BeanUtils.java
> ===================================================================
> RCS file:
> /home/cvspublic/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/BeanUtils.java,v
> retrieving revision 1.32
> diff -u -r1.32 BeanUtils.java
> --- BeanUtils.java 21 Dec 2002 19:33:19 -0000 1.32
> +++ BeanUtils.java 3 Jan 2003 20:52:43 -0000
> @@ -905,7 +905,7 @@
> } else if (value instanceof String[]) {
> newValue = ConvertUtils.convert(((String[]) value)[0],
> type);
> - } else if (ConvertUtils.lookup(value.getClass()) != null) {
> + } else if (value != null &&
> ConvertUtils.lookup(value.getClass()) != null) {
> newValue = ConvertUtils.convert(value.toString(),
> type);
> } else {
> newValue = value;
>
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>