You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by sa...@ca.ibm.com on 2001/03/20 19:23:37 UTC
Patch - fix for [Bug 1023] - min/max Inclusive/Exclusive out of bound
errors not reported by the parser for the datatype long
Hi all, the following fix checks min/max in/exclusive facets for
decimal-derived data types. And the patch file is attached.
package org.apache.xerces.validators.datatype;
diff -w -r1.17 DecimalDatatypeValidator.java
191a192,263
> if (base != null && base instanceof DecimalDatatypeValidator)
> {
> DecimalDatatypeValidator decimalBase
= (DecimalDatatypeValidator)base;
> if ( isMaxExclusiveDefined ) {
> if ( decimalBase.isMaxExclusiveDefined ) {
> int compareTo = fMaxExclusive.compareTo (
decimalBase.fMaxExclusive );
> if ( compareTo == 1 )
> throw new InvalidDatatypeFacetException(
>
"maxExclusive value ='" + fMaxExclusive + "' must be <= the predefined
maxExclusive value ='" +
>
decimalBase.fMaxExclusive + "'." );
> }
> else if ( decimalBase.isMaxInclusiveDefined ) {
> int compareTo = fMaxExclusive.compareTo (
decimalBase.fMaxInclusive );
> if ( compareTo == 1 )
> throw new InvalidDatatypeFacetException(
>
"maxExclusive value ='" + fMaxExclusive + "' must be <= the predefined
maxInclusive value ='" +
>
decimalBase.fMaxInclusive + "'." );
> }
> }
>
> if ( isMaxInclusiveDefined ) {
> if ( decimalBase.isMaxExclusiveDefined ) {
> int compareTo = fMaxInclusive.compareTo (
decimalBase.fMaxExclusive );
> if ( compareTo != -1 )
> throw new InvalidDatatypeFacetException(
>
"maxInclusive value ='" + fMaxInclusive + "' must be < the predefined
maxExclusive value ='" +
>
decimalBase.fMaxExclusive + "'." );
> }
> else if ( decimalBase.isMaxInclusiveDefined ) {
> int compareTo = fMaxInclusive.compareTo (
decimalBase.fMaxInclusive );
> if ( compareTo == 1 )
> throw new InvalidDatatypeFacetException(
>
"maxInclusive value ='" + fMaxInclusive + "' must be <= the predefined
maxInclusive value ='" +
>
decimalBase.fMaxInclusive + "'." );
> }
> }
>
> if ( isMinExclusiveDefined ) {
> if ( decimalBase.isMinExclusiveDefined ) {
> int compareTo = fMinExclusive.compareTo (
decimalBase.fMinExclusive );
> if ( compareTo == -1 )
> throw new InvalidDatatypeFacetException(
>
"MinExclusive value ='" + fMinExclusive + "' must be >= the predefined
MinExclusive value ='" +
>
decimalBase.fMinExclusive + "'." );
> }
> else if ( decimalBase.isMinInclusiveDefined ) {
> int compareTo = fMinExclusive.compareTo (
decimalBase.fMinInclusive );
> if ( compareTo == -1 )
> throw new InvalidDatatypeFacetException(
>
"MinExclusive value ='" + fMinExclusive + "' must be >= the predefined
MinInclusive value ='" +
>
decimalBase.fMinInclusive + "'." );
> }
> }
>
> if ( isMinInclusiveDefined ) {
> if ( decimalBase.isMinExclusiveDefined ) {
> int compareTo = fMinInclusive.compareTo (
decimalBase.fMinExclusive );
> if ( compareTo != 1 )
> throw new InvalidDatatypeFacetException(
>
"MinInclusive value ='" + fMinInclusive + "' must be > the predefined
MinExclusive value ='" +
>
decimalBase.fMinExclusive + "'." );
> }
> else if ( decimalBase.isMinInclusiveDefined ) {
> int compareTo = fMinInclusive.compareTo (
decimalBase.fMinInclusive );
> if ( compareTo == -1 )
> throw new InvalidDatatypeFacetException(
>
"MinInclusive value ='" + fMinInclusive + "' must be >= the predefined
MinInclusive value ='" +
>
decimalBase.fMinInclusive + "'." );
> }
> }
> }
>
226d297
<
Cheers,
Sandy Gao
Software Developer, IBM Canada
(1-416) 448-3255
sandygao@ca.ibm.com
(See attached file: diff.txt)