Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5FC781026B for ; Tue, 23 Apr 2013 10:25:23 +0000 (UTC) Received: (qmail 52550 invoked by uid 500); 23 Apr 2013 10:25:23 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 51744 invoked by uid 500); 23 Apr 2013 10:25:17 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 51010 invoked by uid 99); 23 Apr 2013 10:25:15 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Apr 2013 10:25:15 +0000 Date: Tue, 23 Apr 2013 10:25:15 +0000 (UTC) From: "Hubert Grininger (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (BEANUTILS-387) [beanutils] copyProperties() throws a ConversionException : No value specified for 'Date' when the field is a java.util.Date with a null value MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/BEANUTILS-387?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13638933#comment-13638933 ] Hubert Grininger commented on BEANUTILS-387: -------------------------------------------- I'd like to back Marcin's point here.. For me the sole reason to use BeanUtils.copyProperties is copy over all the properties from object A to object B, if it's null in A it should be null in B as well. Introducing the need for some boilerplate code really make things worse. > [beanutils] copyProperties() throws a ConversionException : No value specified for 'Date' when the field is a java.util.Date with a null value > ----------------------------------------------------------------------------------------------------------------------------------------------- > > Key: BEANUTILS-387 > URL: https://issues.apache.org/jira/browse/BEANUTILS-387 > Project: Commons BeanUtils > Issue Type: Bug > Components: Bean / Property Utils > Affects Versions: 1.8.3 > Reporter: Daniel Marchese > > We have migrated the library from version 1.6.0 to 1.8.0 and the copyProperties() method fails when copying a java.util.Date attribute with a null value. > Here is a simple testcase : > {code} > public class Test { > private Date date; > > public Date getDate() { return date; } > public void setDate(Date date) { this.date = date; } > public static void main(String[] args) throws Exception { > Test dest = new Test(); > Test source = new Test(); > BeanUtils.copyProperties(dest, source); > } > } > {code} > As a workaround, we can do this : > ConvertUtils.register(new DateConverter(null), Date.class); > When can also use PropertyUtils.copyProperties() because in this case no conversion is required but the impact is unknown on our big application. > The problem is that there seems to be a regression between version 1.6.0 and 1.8.0. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira