From user-return-21894-apmail-commons-user-archive=commons.apache.org@commons.apache.org Fri Oct 03 18:30:55 2008 Return-Path: Delivered-To: apmail-commons-user-archive@www.apache.org Received: (qmail 81420 invoked from network); 3 Oct 2008 18:30:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Oct 2008 18:30:55 -0000 Received: (qmail 85961 invoked by uid 500); 3 Oct 2008 18:30:50 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 85890 invoked by uid 500); 3 Oct 2008 18:30:50 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 85879 invoked by uid 99); 3 Oct 2008 18:30:50 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Oct 2008 11:30:50 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of fiznool@hotmail.com designates 65.54.246.84 as permitted sender) Received: from [65.54.246.84] (HELO bay0-omc1-s12.bay0.hotmail.com) (65.54.246.84) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Oct 2008 18:29:46 +0000 Received: from BAY131-W21 ([65.55.136.56]) by bay0-omc1-s12.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 3 Oct 2008 11:30:20 -0700 Message-ID: Content-Type: multipart/alternative; boundary="_c759c04a-073c-4300-b458-8921d04e5b4d_" X-Originating-IP: [194.205.195.34] From: Tom Spencer To: Subject: BeanUtils copyProperties with null Date Date: Fri, 3 Oct 2008 19:30:20 +0100 Importance: Normal In-Reply-To: <1223058035.67615.ezmlm@commons.apache.org> References: <1223058035.67615.ezmlm@commons.apache.org> MIME-Version: 1.0 X-OriginalArrivalTime: 03 Oct 2008 18:30:20.0819 (UTC) FILETIME=[1793FE30:01C92586] X-Virus-Checked: Checked by ClamAV on apache.org --_c759c04a-073c-4300-b458-8921d04e5b4d_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi=2C I'm new to BeanUtils and I would firstly like to say a big thank you - this= is such a useful utility and has saved me countless hours of my time! I am=2C however=2C running into a difficulty. I am using BeanUtils 1.8.0 to= copy a java.util.Date property from one bean to another. I have noticed th= at if the java.util.Date property is set to null=2C when I call BeanUtils.c= opyProperties() I get the following error: Exception in thread "main" org.apache.commons.beanutils.ConversionException= : No value specified for 'Date' at org.apache.commons.beanutils.converters.AbstractConverter.handleMiss= ing(AbstractConverter.java:310) at org.apache.commons.beanutils.converters.AbstractConverter.convert(Ab= stractConverter.java:136) at org.apache.commons.beanutils.converters.ConverterFacade.convert(Conv= erterFacade.java:60) at org.apache.commons.beanutils.BeanUtilsBean.convert(BeanUtilsBean.jav= a:1074) at org.apache.commons.beanutils.BeanUtilsBean.copyProperty(BeanUtilsBea= n.java:437) at org.apache.commons.beanutils.BeanUtilsBean.copyProperties(BeanUtilsB= ean.java:286) at org.apache.commons.beanutils.BeanUtils.copyProperties(BeanUtils.java= :137) at Main.main(Main.java:10) I have copied the sample code for the two beans and a test main class below= . Could anybody else verify that this is occurring too? I am using beanutil= s-1.8.0. Tom ------------------------------------- import java.util.Date=3B public class Bean1 { =20 private Date date=3B public Bean1() { super()=3B } public Date getDate() { return date=3B } public void setDate(Date date) { this.date =3D date=3B } =20 } ------------------------------------- import java.util.Date=3B public class Bean2 { =20 private Date date=3B public Bean2() { super()=3B } public Date getDate() { return date=3B } public void setDate(Date date) { this.date =3D date=3B } =20 } ------------------------------------- import org.apache.commons.beanutils.BeanUtils=3B public class Main { public static void main(String[] args) throws Exception { Bean1 bean1 =3D new Bean1()=3B bean1.setDate(null)=3B Bean2 bean2 =3D new Bean2()=3B =20 BeanUtils.copyProperties(bean2=2C bean1)=3B =20 System.out.println(bean2.getDate())=3B =20 } } _________________________________________________________________ Discover Bird's Eye View now with Multimap from Live Search http://clk.atdmt.com/UKM/go/111354026/direct/01/= --_c759c04a-073c-4300-b458-8921d04e5b4d_--