struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Morris" <David.Mor...@plumcreek.com>
Subject Bean Utils patch for beta 1.3
Date Fri, 03 Jan 2003 20:55:54 GMT
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:   <mailto:struts-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-dev-help@jakarta.apache.org>


Mime
View raw message