commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "" <>
Subject Unparseable date: ""
Date Wed, 06 Sep 2006 12:53:57 GMT
Hi !

I'm new to betwixt and i would need some help to convert
date fields from xml to java. Here is my problem :
I have an object with some Date fields in it. I generate an
xml file using betwixt, everything works fine.
When i try to parse the xml generated and get a java object,
i get an error if a date field is empty (i.e: if date was
null when i convert it to xml)

ERROR digester.Digester  - Body event threw exception
org.apache.commons.beanutils.ConversionException: String to
object conversion failed: Unparseable date: ""

if no date field is empty, then it works. Here is the XML i
tried to convert :

<creditBO id="1">
<datr11>Fri Jun 02 00:00:00 CEST 2006</datr11>
<dtMajQqo>Mon Sep 04 14:44:32 CEST 2006</dtMajQqo>
<dtmaj>Mon Sep 04 14:44:32 CEST 2006</dtmaj>
<dtCreation>Mon Sep 04 14:44:32 CEST 2006</dtCreation>

ddve00 is a date field :
if i have <ddve00>Fri Jun 02 00:00:00 CEST 2006</ddve00> it
if i have <ddve00/> is crashes.

I looked on the mailing list, and all i found was a message
about registering a custom date converter for ConvertUtils,
with something like this :
MyDateConverter converter = new MyDateConverter();
ConvertUtils.register(converter, java.util.Date.class);

I think there must be an easier solution, i just need to be
able to get null when the xml contains "" for a date.
And if there is no other solution, where can i find some
docs or exemple on creating a date Converter.

Thanks in advance !

--------------------- ALICE SECURITE ENFANTS ---------------------
Protégez vos enfants des dangers d'Internet en installant Sécurité Enfants, le contrôle
parental d'Alice.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message