mrglavas    2004/09/20 15:51:09

  Modified:    java/src/org/apache/xerces/impl/dv/xs
                        AbstractDateTimeDV.java
  Log:
  Handle December 31st, 24:00:00 year -1 == January 1st, 00:00:00 year 0

  which is 1 BCE in the first WD for XML Schema 1.1. Thanks to Ankit Pasricha

  for catching this.
  
  Revision  Changes    Path
  1.16      +10 -4     
xml-xerces/java/src/org/apache/xerces/impl/dv/xs/AbstractDateTimeDV.java
  
  Index: AbstractDateTimeDV.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xerces/java/src/org/apache/xerces/impl/dv/xs/AbstractDateTimeDV.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- AbstractDateTimeDV.java   20 Sep 2004 22:39:58 -0000      1.15
  +++ AbstractDateTimeDV.java   20 Sep 2004 22:51:08 -0000      1.16
  @@ -374,8 +374,10 @@
   
           //REVISIT: should we throw an exception for not valid dates
           //          or reporting an error message should be sufficient?
  -     
  -     
  +             
  +        /**
  +         * XML Schema 1.1 - RQ-123: Allow year 0000 in date related types.
  +         */
           if (!Constants.SCHEMA_1_1_SUPPORT && data.year==0 ) {
               throw new RuntimeException("The year \"0000\" is an illegal year 
value");
   
  @@ -399,8 +401,12 @@
                       data.day = 1;
                       if (++data.month > 12) {
                           data.month = 1;
  -                        if (++data.year == 0)
  +                        if (Constants.SCHEMA_1_1_SUPPORT) {
  +                            ++data.year;
  +                        }
  +                        else if (++data.year == 0) {
                               data.year = 1;
  +                        }
                       }
                   }
               }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to