Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 55705 invoked from network); 2 Nov 2006 12:46:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 Nov 2006 12:46:03 -0000 Received: (qmail 75538 invoked by uid 500); 2 Nov 2006 12:46:09 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 75491 invoked by uid 500); 2 Nov 2006 12:46:09 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 75477 invoked by uid 99); 2 Nov 2006 12:46:09 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Nov 2006 04:46:09 -0800 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [65.201.144.130] (HELO datasourceinc.com) (65.201.144.130) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Nov 2006 04:45:54 -0800 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: Digester and using of java.util.Date X-MimeOLE: Produced By Microsoft Exchange V6.5 Date: Thu, 2 Nov 2006 07:45:33 -0500 Message-ID: In-Reply-To: <31cc37360611020020m6311d758g84336d6462d1fb79@mail.gmail.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Digester and using of java.util.Date thread-index: Acb+V9aPHyjxSWgpQvKqLPekvR6dwgAI7+Lw From: "David Sills" To: "Jakarta Commons Users List" X-Virus-Checked: Checked by ClamAV on apache.org Having worked with BeanUtils before, I seem to recall that the main = reason there isn't a java.util.Date converter is that unlike = java.sql.Date, it doesn't have a favored String format that is = guaranteed to convert correctly. I was able in my previous usage to register a particular converter for = java.util.Date as correctly suggested by Henri, and it worked fine, but = this is not a problem that can be solved in a generic way, so far as I = can see. It might be useful for the future to be able to specify some = configuration information for ConvertUtils. For instance, if a date = format or formats (why not go for it?) for java.util.Date were specified = (system property, directly passed in on creation, or however: I don't = recall the implementation details of ConvertUtil) perhaps it could = instantiate a converter (one that used multiple formats, perhaps, as = they do in .NET). There would almost undoubtedly be more converters that = could benefit from such a mechanism, I would think. My $0.02. David -----Original Message----- From: Henri Yandell [mailto:flamefew@gmail.com]=20 Sent: Thursday, November 02, 2006 3:21 AM To: Jakarta Commons Users List Subject: Re: Digester and using of java.util.Date On 11/1/06, Zmitko, Jan wrote: > Hi, > > I=B4ve a question why it=B4s not possible to use "java.util.Date" in > digester respectively in the digester rule file. Instead the type > "java.sql.Date" works. This was a fun one :) > Can someone explain me what=B4s the reason? Under the hood, Digester uses BeanUtils to do its converting. If you look at ConvertUtilsBean [http://svn.apache.org/repos/asf/jakarta/commons/proper/beanutils/trunk/s= rc/java/org/apache/commons/beanutils/ConvertUtilsBean.java] and search for Date, you'll see that by default BeanUtils does not register a converter for java.util.Date. The other direction was resolved in BeanUtils a little while ago: http://issues.apache.org/jira/browse/BEANUTILS-239 but that's for Date->String. I've raised an issue for converting in this direction: http://issues.apache.org/jira/browse/BEANUTILS-255. If it's not something you can work around, you could write a UtilDateConverter of your own and register it with ConvertUtils for java.util.Date (and submit to BEANUTILS-255? :) ); or follow BEANUTILS-255 and one should hopefully be added soon. BeanUtils has been pretty inactive, but a few of us have started digging into its backlog of issues recently. Hen --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org