[prev in list] [next in list] [prev in thread] [next in thread]
List: xerces-cvs
Subject: cvs commit: xml-xerces/java/src/org/apache/xerces/validators/datatype AbstractNumericFacetValidator.
From: elena () apache ! org
Date: 2001-05-30 21:25:51
[Download RAW message or body]
elena 01/05/30 14:25:50
Modified: java/src/org/apache/xerces/validators/datatype
AbstractNumericFacetValidator.java
DateTimeValidator.java
Log:
[fix] date/time comparison may result in _indeterminate_ value.
Revision Changes Path
1.5 +38 -19 \
xml-xerces/java/src/org/apache/xerces/validators/datatype/AbstractNumericFacetValidator.java
Index: AbstractNumericFacetValidator.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/AbstractNumericFacetValidator.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AbstractNumericFacetValidator.java 2001/05/15 14:52:01 1.4
+++ AbstractNumericFacetValidator.java 2001/05/30 21:25:47 1.5
@@ -71,7 +71,7 @@
* minInclusive, maxInclusive, minExclusive, maxExclusive according to schema \
specs.
*
* @author Elena Litani
- * @version $Id: AbstractNumericFacetValidator.java,v 1.4 2001/05/15 14:52:01 \
elena Exp $ + * @version $Id: AbstractNumericFacetValidator.java,v 1.5 2001/05/30 \
21:25:47 elena Exp $
*/
public abstract class AbstractNumericFacetValidator extends \
AbstractDatatypeValidator { @@ -82,6 +82,8 @@
protected Object fMinInclusive = null;
protected Object fMinExclusive = null;
+ protected static final short INDETERMINATE=2;
+
public AbstractNumericFacetValidator () throws InvalidDatatypeFacetException \
{
this( null, null, false ); // Native, No Facets defined, Restriction
}
@@ -97,6 +99,7 @@
initializeValues();
// Set Facets if any defined
if ( facets != null ) {
+ int result; // result of comparison
Vector enumeration = null;
for ( Enumeration e = facets.keys(); e.hasMoreElements(); ) {
String key = (String) e.nextElement();
@@ -152,7 +155,6 @@
}
if ( fFacetsDefined != 0 ) {
-
// check 4.3.8.c1 error: maxInclusive + maxExclusive
if ( ((fFacetsDefined & DatatypeValidator.FACET_MAXEXCLUSIVE) != \
0) &&
((fFacetsDefined & DatatypeValidator.FACET_MAXINCLUSIVE) != \
0) ) { @@ -167,13 +169,15 @@
// check 4.3.7.c1 must: minInclusive <= maxInclusive
if ( ((fFacetsDefined & DatatypeValidator.FACET_MAXINCLUSIVE) != \
0) &&
((fFacetsDefined & DatatypeValidator.FACET_MININCLUSIVE) != \
0) ) {
- if ( compareValues(fMinInclusive, fMaxInclusive) == 1 )
+ result = compareValues(fMinInclusive, fMaxInclusive);
+ if ( result == 1 || result == INDETERMINATE)
throw new InvalidDatatypeFacetException( "minInclusive \
value ='" + getMinInclusive(false) + "'must be <= maxInclusive value \
='" +
\
getMaxInclusive(false) + "'. " ); }
// check 4.3.8.c2 must: minExclusive <= maxExclusive ??? \
minExclusive < maxExclusive
if ( ((fFacetsDefined & DatatypeValidator.FACET_MAXEXCLUSIVE) != \
0) && ((fFacetsDefined & DatatypeValidator.FACET_MINEXCLUSIVE) != 0) \
) {
- if ( compareValues(fMinExclusive, fMaxExclusive) == 1 )
+ result =compareValues(fMinExclusive, fMaxExclusive);
+ if ( result == 1 || result == INDETERMINATE)
throw new InvalidDatatypeFacetException( "minExclusive \
value ='" + getMinExclusive(false) + "'must be <= maxExclusive value \
='" +
\
getMaxExclusive(false) + "'. " ); }
@@ -202,7 +206,7 @@
// maxInclusive >= base.maxExclusive
// maxInclusive < base.minInclusive
// maxInclusive <= base.minExclusive
- int result;
+
if ( ((fFacetsDefined & DatatypeValidator.FACET_MAXINCLUSIVE) \
!= 0) ) {
if ( ((numBase.fFacetsDefined & \
DatatypeValidator.FACET_MAXINCLUSIVE) != 0)){
result = compareValues(fMaxInclusive, \
numBase.fMaxInclusive); @@ -212,7 +216,7 @@
"' must \
be equal to base.maxInclusive value = '" +
\
getMaxInclusive(true) + "' with attribute {fixed} = true" ); }
- if ( result == 1 ){
+ if ( result == 1 || result == INDETERMINATE){
throw new InvalidDatatypeFacetException( \
"maxInclusive value ='" + getMaxInclusive(false) + "' must be <= base.maxInclusive \
value ='" +
\
getMaxInclusive(true) + "'." ); }
@@ -222,10 +226,13 @@
throw new InvalidDatatypeFacetException(
"maxInclusive \
value ='" + getMaxInclusive(false) + "' must be < base.maxExclusive \
value ='" +
\
getMaxExclusive(true) + "'." );
- if ( (( numBase.fFacetsDefined & \
DatatypeValidator.FACET_MININCLUSIVE) != 0) &&
- compareValues(fMaxInclusive, numBase.fMinInclusive) \
== -1 ) + if ( (( numBase.fFacetsDefined & \
DatatypeValidator.FACET_MININCLUSIVE) != 0)){ + result \
= compareValues(fMaxInclusive, numBase.fMinInclusive); + \
if (result == -1 || result == INDETERMINATE) { throw new \
InvalidDatatypeFacetException( "maxInclusive value ='" + getMaxInclusive(false) + "' \
must be >= base.minInclusive value ='" +
\
getMinInclusive(true) + "'." ); + }
+ }
if ( (( numBase.fFacetsDefined & \
DatatypeValidator.FACET_MINEXCLUSIVE) != 0) &&
compareValues(fMaxInclusive, numBase.fMinExclusive ) \
!= 1 ) throw new InvalidDatatypeFacetException(
@@ -247,15 +254,18 @@
"' must \
be equal to base.maxExclusive value = '" +
\
getMaxExclusive(true) + "' with attribute {fixed} = true" ); }
- if (result == 1) {
+ if (result == 1 || result == INDETERMINATE) {
throw new InvalidDatatypeFacetException( \
"maxExclusive value ='" + getMaxExclusive(false) + "' must be < base.maxExclusive \
value ='" +
\
getMaxExclusive(true) + "'." ); }
}
- if ( (( numBase.fFacetsDefined & \
DatatypeValidator.FACET_MAXINCLUSIVE) != 0) &&
- compareValues(fMaxExclusive, numBase.fMaxInclusive) \
== 1 ) + if ( (( numBase.fFacetsDefined & \
DatatypeValidator.FACET_MAXINCLUSIVE) != 0)){ + result= \
compareValues(fMaxExclusive, numBase.fMaxInclusive); + if \
(result == 1 || result == INDETERMINATE) { throw new \
InvalidDatatypeFacetException( "maxExclusive value ='" + getMaxExclusive(false) + "' \
must be <= base.maxInclusive value ='" +
\
getMaxInclusive(true) + "'." ); + }
+ }
if ( (( numBase.fFacetsDefined & \
DatatypeValidator.FACET_MINEXCLUSIVE) != 0) &&
compareValues(fMaxExclusive, numBase.fMinExclusive ) \
!= 1 )
throw new InvalidDatatypeFacetException( "maxExclusive \
value ='" + getMaxExclusive(false) + "' must be > base.minExclusive value ='" + @@ \
-280,21 +290,27 @@
"' must be \
equal to base.minExclusive value = '" +
\
getMinExclusive(true) + "' with attribute {fixed} = true" ); }
- if (result == -1) {
+ if (result == -1 || result == INDETERMINATE) {
throw new InvalidDatatypeFacetException( \
"minExclusive value ='" + getMinExclusive(false) + "' must be >= base.minExclusive \
value ='" +
\
getMinExclusive(true) + "'." ); }
}
- if ( (( numBase.fFacetsDefined & \
DatatypeValidator.FACET_MAXINCLUSIVE) != 0) &&
- compareValues(fMinExclusive, numBase.fMaxInclusive) \
== 1 ) + if ( (( numBase.fFacetsDefined & \
DatatypeValidator.FACET_MAXINCLUSIVE) != 0)){ + \
result=compareValues(fMinExclusive, numBase.fMaxInclusive); + \
if (result == 1 || result == INDETERMINATE) { throw new \
InvalidDatatypeFacetException(
"minExclusive \
value ='" + getMinExclusive(false) + "' must be <= base.maxInclusive \
value ='" +
\
getMaxInclusive(true) + "'." );
- if ( (( numBase.fFacetsDefined & \
DatatypeValidator.FACET_MININCLUSIVE) != 0) &&
- compareValues(fMinExclusive, numBase.fMinInclusive) \
== -1 ) + }
+ }
+ if ( (( numBase.fFacetsDefined & \
DatatypeValidator.FACET_MININCLUSIVE) != 0)){ + result = \
compareValues(fMinExclusive, numBase.fMinInclusive); + \
if (result == -1 || result == INDETERMINATE) { throw \
new InvalidDatatypeFacetException(
"minExclusive \
value ='" + getMinExclusive(false) + "' must be >= base.minInclusive \
value ='" +
\
getMinInclusive(true) + "'." ); + }
+ }
if ( (( numBase.fFacetsDefined & \
DatatypeValidator.FACET_MAXEXCLUSIVE) != 0) &&
compareValues(fMinExclusive, numBase.fMaxExclusive) \
!= -1 )
throw new InvalidDatatypeFacetException( "minExclusive \
value ='" + getMinExclusive(false) + "' must be < base.maxExclusive value ='" + @@ \
-315,15 +331,18 @@
"' must be \
equal to base.minInclusive value = '" +
\
getMinInclusive(true) + "' with attribute {fixed} = true" ); }
- if (result == -1 ){
+ if (result == -1 || result == INDETERMINATE){
throw new InvalidDatatypeFacetException( \
"minInclusive value ='" + getMinInclusive(false) + "' must be >= base.minInclusive \
value ='" +
\
getMinInclusive(true) + "'." ); }
}
- if ( (( numBase.fFacetsDefined & \
DatatypeValidator.FACET_MAXINCLUSIVE) != 0) &&
- compareValues(fMinInclusive, numBase.fMaxInclusive) \
== 1 ) + if ( (( numBase.fFacetsDefined & \
DatatypeValidator.FACET_MAXINCLUSIVE) != 0)){ + \
result=compareValues(fMinInclusive, numBase.fMaxInclusive); + \
if (result == 1 || result == INDETERMINATE) { throw new \
InvalidDatatypeFacetException( "minInclusive value ='" + getMinInclusive(false) + "' \
must be <= base.maxInclusive value ='" +
\
getMaxInclusive(true) + "'." ); + }
+ }
if ( (( numBase.fFacetsDefined & \
DatatypeValidator.FACET_MINEXCLUSIVE) != 0) &&
compareValues(fMinInclusive, numBase.fMinExclusive ) \
!= 1 )
throw new InvalidDatatypeFacetException( "minInclusive \
value ='" + getMinInclusive(false) + "' must be > base.minExclusive value ='" +
1.9 +1 -2 \
xml-xerces/java/src/org/apache/xerces/validators/datatype/DateTimeValidator.java
Index: DateTimeValidator.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/DateTimeValidator.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- DateTimeValidator.java 2001/05/03 19:57:32 1.8
+++ DateTimeValidator.java 2001/05/30 21:25:48 1.9
@@ -72,7 +72,7 @@
* @author Elena Litani
* @author Len Berman
*
- * @version $Id: DateTimeValidator.java,v 1.8 2001/05/03 19:57:32 elena Exp $
+ * @version $Id: DateTimeValidator.java,v 1.9 2001/05/30 21:25:48 elena Exp $
*/
public abstract class DateTimeValidator extends AbstractNumericFacetValidator {
@@ -90,7 +90,6 @@
protected static final short LESS_THAN=-1;
protected static final short EQUAL=0;
protected static final short GREATER_THAN=1;
- protected static final short INDETERMINATE=2;
//size for all objects must have the same fields:
//CCYY, MM, DD, h, m, s, ms + timeZone
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic