sandygao 2003/04/02 06:12:00 Modified: java/src/org/apache/xerces/impl/dv/xs AbstractDateTimeDV.java Log: Fixing a bug in dateTime comparison algorithem. Sometimes 2 values aren't comparable if one has time zone and the other one doesn't. Revision Changes Path 1.11 +14 -15 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.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- AbstractDateTimeDV.java 17 Mar 2003 15:51:15 -0000 1.10 +++ AbstractDateTimeDV.java 2 Apr 2003 14:12:00 -0000 1.11 @@ -2,7 +2,7 @@ * The Apache Software License, Version 1.1 * * - * Copyright (c) 1999-2002 The Apache Software Foundation. All rights + * Copyright (c) 1999-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -133,6 +133,8 @@ tempDate[utc]='+'; normalize(tempDate, timeZone); c1 = compareOrder(date1, tempDate); + if (c1 == LESS_THAN) + return c1; //compare date1>=(date2 with time zone +14) // @@ -142,13 +144,10 @@ tempDate[utc]='-'; normalize(tempDate, timeZone); c2 = compareOrder(date1, tempDate); + if (c2 == GREATER_THAN) + return c2; - if ( (c1 < 0 && c2 > 0) || - (c1 == 0 && c2 == 0) ) { - return INDETERMINATE; - } - //REVISIT: wait for clarification on this case from schema - return(c1!=INDETERMINATE)?c1:c2; + return INDETERMINATE; } else if ( date2[utc]=='Z' ) { @@ -157,7 +156,6 @@ cloneDate(date1, tempDate); //clones date1 value to global temporary storage: tempDate timeZone[hh]=14; timeZone[mm]=0; - tempDate[utc]='-'; if (DEBUG) { System.out.println("tempDate=" + dateToString(tempDate)); @@ -168,6 +166,9 @@ System.out.println("date=" + dateToString(date2)); System.out.println("tempDate=" + dateToString(tempDate)); } + if (c1 == LESS_THAN) + return c1; + //compare (date1 with time zone +14)<=date2 // cloneDate(date1, tempDate); //clones date1 value to global temporary storage: tempDate @@ -179,12 +180,10 @@ if (DEBUG) { System.out.println("tempDate=" + dateToString(tempDate)); } - if ( (c1 < 0 && c2 > 0) || - (c1 == 0 && c2 == 0) ) { - return INDETERMINATE; - } - //REVISIT: wait for clarification on this case from schema - return(c1!=INDETERMINATE)?c1:c2; + if (c2 == GREATER_THAN) + return c2; + + return INDETERMINATE; } return INDETERMINATE;
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]