users@jaxb.java.net

Re: Date

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Tue, 28 Feb 2006 10:08:36 -0800

Vallamshettla, Anand wrote:
> 1) When the xs:date type element in XML file is set to 0000-00-00, after
> parsing the Calendar object has a value of 0002-11-30. It is giving me a
> gibberish date, it should have thrown an exception or something so that
> we know something is wrong with the file. I was wondering how the rest
> of you are handling this situation.

Interesting. I'm curious why 0000-00-00 becomes 0002-11-30. Hmm, maybe
it's BC?

In any case, you can always turn on the validation to detect those
errors (and a lot more.)

> 2) When the xs:date type element in XML file is set to 2005-13-12, date
> is being converted to 2006-01-12 as lenient feature is set by default on
> Calendar. Is there a way to set lenient off on Calendar type with minor
> customization and let JAXB throw exception those cases?

Enabling validation will also detect this.


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com