users@jaxb.java.net

dateTime format

From: <marcus.walls_at_aspective.com>
Date: Thu, 11 Dec 2003 09:33:23 -0000

I've recently upgraded one of our systems from the initial RI release to the
1.0.2 release included in JWSDP1.3.
I had to make a couple of adjustments to the generated runtime to allow
running under 1.2.2 but other than that everything went smoothly.
 
However, when we hooked our system up to the customer system (our systems
exchange XML messages) the customer system rejected a fair proportion of our
XML - it claimed the timestamps were invalid.
 
The problem is basically that the customer didn't bother to write a proper
dateTime parser and assumed that milliseconds would always be present.
And it would appear that the JAXB 1.0.2 omits the millisecond part of the
timestamp if it is zero whereas 1.0.0 did not.
 
I have hunted down the piece of code responsible
(com.sun.msv.datatype.xsd.DateTimeBaseType) which thankfully is in the
open-source bit. By way of experiment, I resolved the problem by dowloading
the nightly build of xsdlib.jar and "fixing" the code. This appears to work
fine.
 
However, I'm curious to know whether or not there was a specific reason for
adding the "drop zero milliseconds" functionality, or whether it was just
tidying up? I'm not asking for it to be changed - it seems perfectly
reasonable to drop the trailing zeroes - I would just like to understand the
rationale behind it.
 
Is there a better way to fix the problem other than modifying the JAR? I'm
assuming that since xsdlib.jar is open-source I'm legally permitted to
change it, but as this was an emergency I've not had chance to check that
out yet. So if anybody's got an opinion on that, I'd be interested to hear
it.
 
Marcus