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 Elena Litani <hl...@jtcsv.com> on 2001/03/15 21:52:42 UTC

Re: Patch - fix for [Bug 740] - An error is not raised by the parser for aviolation of the constraint minExclusive <= maxExclusive

Hi, Sandy,
Thanks for looking at bugs :).
I applied your fix to Double only.. As I said
TimeDuration/RecurringDuration are broken. 

Elena.

sandygao@ca.ibm.com wrote:
> 
> Hi all, the reason for this bug is that we don't check whether
> fMinEx/Inclusive <= fMinEx/Inclusive for float datatype (in fact, the same
> problem would occur for other types: double, TimeDuration,
> RecurringDuration, and QName). The only data type that we do such check on
> is decimal. So the fix is to copy the checking code from decimal to other
> types. The patch file is attached, and the change is shown below.
> 
> diff -w -r1.6 TimeDurationDatatypeValidator.java
> 206a207,233
> >             if ( isMaxExclusiveDefined && isMinExclusiveDefined ){
> >                 if ( fMaxExclusive <= fMinExclusive )
> >                     throw new InvalidDatatypeFacetException(
> >                                                             "maxExclusive
> value ='" + this.fMaxExclusive + "'must be > than minExclusive value ='" +
> >
> this.fMinExclusive + "'. " );
> >
> >             }
> >             if ( isMaxInclusiveDefined && isMinInclusiveDefined ){
> >                 if ( fMaxInclusive < fMinInclusive )
> >                     throw new InvalidDatatypeFacetException(
> >                                                             "maxInclusive
> value ='" + this.fMaxInclusive + "'must be >= than minInclusive value ='" +
> >
> this.fMinInclusive + "'. " );
> >             }
> >             if ( isMaxExclusiveDefined && isMinInclusiveDefined ){
> >                 if ( fMaxExclusive <= fMinInclusive )
> >                     throw new InvalidDatatypeFacetException(
> >                                                             "maxExclusive
> value ='" + this.fMaxExclusive + "'must be > than minInclusive value ='" +
> >
> this.fMinInclusive + "'. " );
> >
> >             }
> >             if ( isMaxInclusiveDefined && isMinExclusiveDefined ){
> >                 if ( fMaxInclusive <= fMinExclusive )
> >                     throw new InvalidDatatypeFacetException(
> >                                                             "maxInclusive
> value ='" + this.fMaxInclusive + "'must be > than minExclusive value ='" +
> >
> this.fMinExclusive + "'. " );
> >             }
> >
> 
> diff -w -r1.8 RecurringDurationDatatypeValidator.java
> 240a241,268
> >             if ( isMaxExclusiveDefined && isMinExclusiveDefined ){
> >                 if ( fMaxExclusive <= fMinExclusive )
> >                     throw new InvalidDatatypeFacetException(
> >                                                             "maxExclusive
> value ='" + this.fMaxExclusive + "'must be > than minExclusive value ='" +
> >
> this.fMinExclusive + "'. " );
> >
> >             }
> >             if ( isMaxInclusiveDefined && isMinInclusiveDefined ){
> >                 if ( fMaxInclusive < fMinInclusive )
> >                     throw new InvalidDatatypeFacetException(
> >                                                             "maxInclusive
> value ='" + this.fMaxInclusive + "'must be >= than minInclusive value ='" +
> >
> this.fMinInclusive + "'. " );
> >             }
> >             if ( isMaxExclusiveDefined && isMinInclusiveDefined ){
> >                 if ( fMaxExclusive <= fMinInclusive )
> >                     throw new InvalidDatatypeFacetException(
> >                                                             "maxExclusive
> value ='" + this.fMaxExclusive + "'must be > than minInclusive value ='" +
> >
> this.fMinInclusive + "'. " );
> >
> >             }
> >             if ( isMaxInclusiveDefined && isMinExclusiveDefined ){
> >                 if ( fMaxInclusive <= fMinExclusive )
> >                     throw new InvalidDatatypeFacetException(
> >                                                             "maxInclusive
> value ='" + this.fMaxInclusive + "'must be > than minExclusive value ='" +
> >
> this.fMinExclusive + "'. " );
> >             }
> >
> >
> 
> diff -w -r1.7 QNameDatatypeValidator.java
> 205a206,237
> >
> >             if ( isMaxExclusiveDefined && isMinExclusiveDefined ){
> >                 int compareTo = this.fMaxExclusive.compareTo(
> this.fMinExclusive );
> >                 if ( compareTo <= 0)
> >                     throw new InvalidDatatypeFacetException(
> >                                                             "maxExclusive
> value ='" + this.fMaxExclusive + "'must be lexicographically greater than
> minExclusive value ='" +
> >
> this.fMinExclusive + "'. " );
> >
> >             }
> >             if ( isMaxInclusiveDefined && isMinInclusiveDefined ){
> >                 int compareTo = this.fMaxInclusive.compareTo(
> this.fMinInclusive );
> >
> >                 if ( compareTo < 0)
> >                     throw new InvalidDatatypeFacetException(
> >                                                             "maxInclusive
> value ='" + this.fMaxInclusive + "'must be lexicographically greater than
> or equal to minInclusive value ='" +
> >
> this.fMinInclusive + "'. " );
> >             }
> >             if ( isMaxExclusiveDefined && isMinInclusiveDefined ){
> >                 int compareTo = this.fMaxExclusive.compareTo(
> this.fMinInclusive );
> >                 if ( compareTo <= 0)
> >                     throw new InvalidDatatypeFacetException(
> >                                                             "maxExclusive
> value ='" + this.fMaxExclusive + "'must be lexicographically greater than
> minInclusive value ='" +
> >
> this.fMinInclusive + "'. " );
> >
> >             }
> >             if ( isMaxInclusiveDefined && isMinExclusiveDefined ){
> >                 int compareTo = this.fMaxInclusive.compareTo(
> this.fMinExclusive );
> >                 if ( compareTo <= 0)
> >                     throw new InvalidDatatypeFacetException(
> >                                                             "maxInclusive
> value ='" + this.fMaxInclusive + "'must be lexicographically greater than
> minExclusive value ='" +
> >
> this.fMinExclusive + "'. " );
> >             }
> 
> diff -w -r1.13 FloatDatatypeValidator.java
> 191a192,217
> >             if ( isMaxExclusiveDefined && isMinExclusiveDefined ){
> >                 if ( fMaxExclusive <= fMinExclusive )
> >                     throw new InvalidDatatypeFacetException(
> >                                                             "maxExclusive
> value ='" + this.fMaxExclusive + "'must be > than minExclusive value ='" +
> >
> this.fMinExclusive + "'. " );
> >
> >             }
> >             if ( isMaxInclusiveDefined && isMinInclusiveDefined ){
> >                 if ( fMaxInclusive < fMinInclusive )
> >                     throw new InvalidDatatypeFacetException(
> >                                                             "maxInclusive
> value ='" + this.fMaxInclusive + "'must be >= than minInclusive value ='" +
> >
> this.fMinInclusive + "'. " );
> >             }
> >             if ( isMaxExclusiveDefined && isMinInclusiveDefined ){
> >                 if ( fMaxExclusive <= fMinInclusive )
> >                     throw new InvalidDatatypeFacetException(
> >                                                             "maxExclusive
> value ='" + this.fMaxExclusive + "'must be > than minInclusive value ='" +
> >
> this.fMinInclusive + "'. " );
> >
> >             }
> >             if ( isMaxInclusiveDefined && isMinExclusiveDefined ){
> >                 if ( fMaxInclusive <= fMinExclusive )
> >                     throw new InvalidDatatypeFacetException(
> >                                                             "maxInclusive
> value ='" + this.fMaxInclusive + "'must be > than minExclusive value ='" +
> >
> this.fMinExclusive + "'. " );
> >             }
> 
> diff -w -r1.12 DoubleDatatypeValidator.java
> 185a186,211
> >             if ( isMaxExclusiveDefined && isMinExclusiveDefined ){
> >                 if ( fMaxExclusive <= fMinExclusive )
> >                     throw new InvalidDatatypeFacetException(
> >                                                             "maxExclusive
> value ='" + this.fMaxExclusive + "'must be > than minExclusive value ='" +
> >
> this.fMinExclusive + "'. " );
> >
> >             }
> >             if ( isMaxInclusiveDefined && isMinInclusiveDefined ){
> >                 if ( fMaxInclusive < fMinInclusive )
> >                     throw new InvalidDatatypeFacetException(
> >                                                             "maxInclusive
> value ='" + this.fMaxInclusive + "'must be >= than minInclusive value ='" +
> >
> this.fMinInclusive + "'. " );
> >             }
> >             if ( isMaxExclusiveDefined && isMinInclusiveDefined ){
> >                 if ( fMaxExclusive <= fMinInclusive )
> >                     throw new InvalidDatatypeFacetException(
> >                                                             "maxExclusive
> value ='" + this.fMaxExclusive + "'must be > than minInclusive value ='" +
> >
> this.fMinInclusive + "'. " );
> >
> >             }
> >             if ( isMaxInclusiveDefined && isMinExclusiveDefined ){
> >                 if ( fMaxInclusive <= fMinExclusive )
> >                     throw new InvalidDatatypeFacetException(
> >                                                             "maxInclusive
> value ='" + this.fMaxInclusive + "'must be > than minExclusive value ='" +
> >
> this.fMinExclusive + "'. " );
> >             }
> 
> *****CVS exited normally with code 1*****
> 
> Sandy Gao
> Software Developer, IBM Canada
> (1-416) 448-3255
> sandygao@ca.ibm.com
> 
> (See attached file: diff.txt)
> 
>   ------------------------------------------------------------------------
>                Name: diff.txt
>    diff.txt    Type: Plain Text (text/plain)
>            Encoding: base64
> 
>   ------------------------------------------------------------------------
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-dev-help@xml.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org