Details
Description
The method org.exolab.castor.types.DateTimeBase.setCentury() should have the same checking as setYear() to avoid setting century and year to 0:
else if ( (_year ==0) && (century==0))
{ err = "0000 is not an allowed year"; throw new IllegalArgumentException(err); }Otherwise you can do:
org.exolab.castor.types.Date dob = new org.exolab.castor.types.Date();
dob.setCentury((short) 1);
dob.setYear((short) 0);
dob.setCentury((short) 0); // no exception here
and if you marshall, you get an "0000-MM-DD" in your XML for date, which is (currently) forbidden (according to http://www.w3.org/TR/xmlschema-2/ chapter 3.2.7).
If you then unmarshall, you get a (correct) error message for the parser.
The attached eclipse project showing the error, is compiled with castor 1.0.1, but the problem is also in 1.0.3.
Rainer, you wouldn't be able to provide me with a patch and a JUnit test case (to easy my side of things) ?