Examples of InvalidDatatypeFacetException


Examples of org.apache.xerces.impl.validation.InvalidDatatypeFacetException

        } else if ( isMinExclusiveDefined ) {
            inLowerBound = ( f >  fMinExclusive );
        }

        if ( inUpperBound == false  || inLowerBound == false ) { // within bounds ?
            throw new InvalidDatatypeFacetException(
                                                   getErrorString(DatatypeMessageProvider.OutOfBounds,
                                                                  DatatypeMessageProvider.MSG_NONE,
                                                                  new Object [] { new Long(f),"","","",""}));//REVISIT
        }
    }
View Full Code Here

Examples of org.apache.xerces.impl.validation.InvalidDatatypeFacetException

                        fFacetsDefined += DatatypeValidator.FACET_LENGTH;
                        String lengthValue = (String)facets.get(key);
                        try {
                            fLength     = Integer.parseInt( lengthValue );
                        } catch (NumberFormatException nfe) {
                            throw new InvalidDatatypeFacetException("Length value '"+
                                                                    lengthValue+"' is invalid.");
                        }
                        if ( fLength < 0 )
                            throw new InvalidDatatypeFacetException("Length value '"+
                                                                    lengthValue+"'  must be a nonNegativeInteger.");

                    } else if (key.equals(SchemaSymbols.ELT_MINLENGTH) ) {
                        fFacetsDefined += DatatypeValidator.FACET_MINLENGTH;
                        String minLengthValue = (String)facets.get(key);
                        try {
                            fMinLength     = Integer.parseInt( minLengthValue );
                        } catch (NumberFormatException nfe) {
                            throw new InvalidDatatypeFacetException("maxLength value '"+minLengthValue+"' is invalid.");
                        }
                    } else if (key.equals(SchemaSymbols.ELT_MAXLENGTH) ) {
                        fFacetsDefined += DatatypeValidator.FACET_MAXLENGTH;
                        String maxLengthValue = (String)facets.get(key);
                        try {
                            fMaxLength     = Integer.parseInt( maxLengthValue );
                        } catch (NumberFormatException nfe) {
                            throw new InvalidDatatypeFacetException("maxLength value '"+maxLengthValue+"' is invalid.");
                        }
                    } else if (key.equals(SchemaSymbols.ELT_PATTERN)) {
                        fFacetsDefined += DatatypeValidator.FACET_PATTERN;
                        fPattern = (String)facets.get(key);
                    } else if (key.equals(SchemaSymbols.ELT_ENUMERATION)) {
                        fFacetsDefined += DatatypeValidator.FACET_ENUMERATION;
                        fEnumeration = (Vector)facets.get(key);
                    } else if (key.equals(SchemaSymbols.ELT_ENCODING )) {
                        fFacetsDefined += DatatypeValidator.FACET_MAXINCLUSIVE;
                        fEncoding = (String)facets.get(key);
                    } else {
                        throw new InvalidDatatypeFacetException();
                    }
                }
                if (((fFacetsDefined & DatatypeValidator.FACET_LENGTH ) != 0 ) ) {
                    if (((fFacetsDefined & DatatypeValidator.FACET_MAXLENGTH ) != 0 ) ) {
                        throw new InvalidDatatypeFacetException(
                                                               "It is an error for both length and maxLength to be members of facets." )
                    } else if (((fFacetsDefined & DatatypeValidator.FACET_MINLENGTH ) != 0 ) ) {
                        throw new InvalidDatatypeFacetException(
                                                               "It is an error for both length and minLength to be members of facets." );
                    }
                }

                if ( ( (fFacetsDefined & ( DatatypeValidator.FACET_MINLENGTH |
                                           DatatypeValidator.FACET_MAXLENGTH) ) != 0 ) ) {
                    if ( fMinLength > fMaxLength ) {
                        throw new InvalidDatatypeFacetException( "Value of maxLength = " + fMaxLength +
                                                                 "must be greater that the value of minLength" + fMinLength );
                    }
                }
        }// End of Facet setting
    }
View Full Code Here

Examples of org.apache.xerces.impl.validation.InvalidDatatypeFacetException

                    fFacetsDefined += DatatypeValidator.FACET_LENGTH;
                    String lengthValue = (String)facets.get(key);
                    try {
                        fLength     = Integer.parseInt( lengthValue );
                    } catch (NumberFormatException nfe) {
                        throw new InvalidDatatypeFacetException("Length value '"+lengthValue+"' is invalid.");
                    }
                    if (fLength < 0)
                        throw new InvalidDatatypeFacetException("Length value '"+lengthValue+"'  must be a nonNegativeInteger.");

                } else if (key.equals("minlength")) {
                    fFacetsDefined += DatatypeValidator.FACET_MINLENGTH;
                    String minLengthValue = (String)facets.get(key);
                    try {
                        fMinLength     = Integer.parseInt( minLengthValue );
                    } catch (NumberFormatException nfe) {
                        throw new InvalidDatatypeFacetException("maxLength value '"+minLengthValue+"' is invalid.");
                    }
                } else if (key.equals("maxlength")) {
                    fFacetsDefined += DatatypeValidator.FACET_MAXLENGTH;
                    String maxLengthValue = (String)facets.get(key);
                    try {
                        fMaxLength     = Integer.parseInt( maxLengthValue );
                    } catch (NumberFormatException nfe) {
                        throw new InvalidDatatypeFacetException("maxLength value '"+maxLengthValue+"' is invalid.");
                    }
                } else if (key.equals("enumeration")) {
                    fFacetsDefined += DatatypeValidator.FACET_ENUMERATION;
                    fEnumeration    = (Vector)facets.get(key);
                } else {
                    throw new InvalidDatatypeFacetException("invalid facet tag : " + key);
                }
            }
            if (((fFacetsDefined & DatatypeValidator.FACET_LENGTH ) != 0 )) {
                if (((fFacetsDefined & DatatypeValidator.FACET_MAXLENGTH ) != 0 )) {
                    throw new InvalidDatatypeFacetException(
                                                           "It is an error for both length and maxLength to be members of facets." )
                } else if (((fFacetsDefined & DatatypeValidator.FACET_MINLENGTH ) != 0 )) {
                    throw new InvalidDatatypeFacetException(
                                                           "It is an error for both length and minLength to be members of facets." );
                }
            }

            if (( (fFacetsDefined & ( DatatypeValidator.FACET_MINLENGTH |
                                      DatatypeValidator.FACET_MAXLENGTH) ) != 0 )) {
                if (fMinLength > fMaxLength) {
                    throw new InvalidDatatypeFacetException( "Value of minLength = " + fMinLength +
                                                             "must be greater that the value of maxLength" + fMaxLength );
                }
            }
        }// End of Facets Setting
    }
View Full Code Here

Examples of org.apache.xerces.impl.validation.InvalidDatatypeFacetException

               fFacetsDefined += DatatypeValidator.FACET_LENGTH;
               String lengthValue = (String)facets.get(key);
               try {
                  fLength     = Integer.parseInt( lengthValue );
               } catch (NumberFormatException nfe) {
                  throw new InvalidDatatypeFacetException("Length value '"+lengthValue+"' is invalid.");
               }
               if ( fLength < 0 )
                  throw new InvalidDatatypeFacetException("Length value '"+lengthValue+"'  must be a nonNegativeInteger.");

            } else if (key.equals("minlength") ) {
               fFacetsDefined += DatatypeValidator.FACET_MINLENGTH;
               String minLengthValue = (String)facets.get(key);
               try {
                  fMinLength     = Integer.parseInt( minLengthValue );
               } catch (NumberFormatException nfe) {
                  throw new InvalidDatatypeFacetException("minLength value '"+minLengthValue+"' is invalid.");
               }
            } else if (key.equals("maxlength") ) {
               fFacetsDefined += DatatypeValidator.FACET_MAXLENGTH;
               String maxLengthValue = (String)facets.get(key);
               try {
                  fMaxLength     = Integer.parseInt( maxLengthValue );
               } catch (NumberFormatException nfe) {
                  throw new InvalidDatatypeFacetException("maxLength value '"+maxLengthValue+"' is invalid.");
               }
            }
            /***
            else if (key.equals(SchemaSymbols.ELT_PATTERN)) {
               fFacetsDefined += DatatypeValidator.FACET_PATTERN;
               fPattern = (String)facets.get(key);
               fRegex   = new RegularExpression(fPattern, "X");
            }
            /***/
            else if (key.equals("enumeration")) {
               fFacetsDefined += DatatypeValidator.FACET_ENUMERATION;
               fEnumeration = (Vector)facets.get(key);
               /* Per Schema CR - October 23 spec we don't have this facets in String datatype
           } else if (key.equals(SchemaSymbols.ELT_MAXINCLUSIVE)) {
               fFacetsDefined += DatatypeValidator.FACET_MAXINCLUSIVE;
               fMaxInclusive = (String)facets.get(key);
           } else if (key.equals(SchemaSymbols.ELT_MAXEXCLUSIVE)) {
               fFacetsDefined += DatatypeValidator.FACET_MAXEXCLUSIVE;
               fMaxExclusive = (String)facets.get(key);
           } else if (key.equals(SchemaSymbols.ELT_MININCLUSIVE)) {
               fFacetsDefined += DatatypeValidator.FACET_MININCLUSIVE;
               fMinInclusive = (String)facets.get(key);
           } else if (key.equals(SchemaSymbols.ELT_MINEXCLUSIVE)) {
               fFacetsDefined += DatatypeValidator.FACET_MINEXCLUSIVE;
               fMinExclusive = (String)facets.get(key);
               */
            } else if (key.equals("whitespace")) {
               String         whiteSpaceChoice = (String)facets.get(key);
               fFacetsDefined += DatatypeValidator.FACET_WHITESPACE;
               if ( whiteSpaceChoice.equals("preserve" ) ) {
                  fWhiteSpace = DatatypeValidator.WHITESPACE_PRESERVE;
               } else if ( whiteSpaceChoice.equals("replace") ) {
                  fWhiteSpace = DatatypeValidator.WHITESPACE_REPLACE;
               } else if ( whiteSpaceChoice.equals("collapse") ) {
                  fWhiteSpace = DatatypeValidator.WHITESPACE_COLLAPSE;
               }
            } else {
               throw new InvalidDatatypeFacetException("invalid facet tag : " + key);
            }
         }

         if (((fFacetsDefined & DatatypeValidator.FACET_LENGTH ) != 0 ) ) {
            if (((fFacetsDefined & DatatypeValidator.FACET_MAXLENGTH ) != 0 ) ) {
               throw new InvalidDatatypeFacetException(
                                                      "It is an error for both length and maxLength to be members of facets." )
            } else if (((fFacetsDefined & DatatypeValidator.FACET_MINLENGTH ) != 0 ) ) {
               throw new InvalidDatatypeFacetException(
                                                      "It is an error for both length and minLength to be members of facets." );
            }
         }

         if ( ( (fFacetsDefined & ( DatatypeValidator.FACET_MINLENGTH |
                                    DatatypeValidator.FACET_MAXLENGTH) ) != 0 ) ) {
            if ( fMinLength > fMaxLength ) {
               throw new InvalidDatatypeFacetException( "Value of minLength = '" + fMinLength +
                                                        "'must be less than the value of maxLength = '" + fMaxLength + "'.");
            }
         }

         isMaxExclusiveDefined = ((fFacetsDefined &
                                   DatatypeValidator.FACET_MAXEXCLUSIVE ) != 0 )?true:false;
         isMaxInclusiveDefined = ((fFacetsDefined &
                                   DatatypeValidator.FACET_MAXINCLUSIVE ) != 0 )?true:false;
         isMinExclusiveDefined = ((fFacetsDefined &
                                   DatatypeValidator.FACET_MINEXCLUSIVE ) != 0 )?true:false;
         isMinInclusiveDefined = ((fFacetsDefined &
                                   DatatypeValidator.FACET_MININCLUSIVE ) != 0 )?true:false;

         if ( isMaxExclusiveDefined && isMaxInclusiveDefined ) {
            throw new InvalidDatatypeFacetException(
                                                   "It is an error for both maxInclusive and maxExclusive to be specified for the same datatype." );
         }
         if ( isMinExclusiveDefined && isMinInclusiveDefined ) {
            throw new InvalidDatatypeFacetException(
                                                   "It is an error for both minInclusive and minExclusive to be specified for the same datatype." );
         }

      }// End of Facets Setting
   }
View Full Code Here

Examples of org.apache.xerces.impl.validation.InvalidDatatypeFacetException

        } catch (InvocationTargetException e) {
            if (fDebug) {
                System.out.println("!! The original error message is: " + e.getTargetException().getMessage() );
                e.getTargetException().printStackTrace();
            } else {
                throw new InvalidDatatypeFacetException( e.getTargetException().getMessage() );
                //System.out.println("Exception: " + e.getTargetException
                //validator = null;
            }
        }
        return validator;
View Full Code Here

Examples of org.apache.xerces.validators.datatype.InvalidDatatypeFacetException

                        fFacetsDefined += DatatypeValidator.FACET_PATTERN;
                        fPattern = (String)facets.get(key);
                        if( fPattern != null )
                           fRegex = new RegularExpression(fPattern, "X" );
                    } else {
                        throw new
                           InvalidDatatypeFacetException(
                                "Only constraining facet in boolean datatype is PATTERN" );
                    }
                }
            } else { // By List
View Full Code Here

Examples of org.apache.xerces.validators.datatype.InvalidDatatypeFacetException

                //for all datatypes other than string, we don't pass WHITESPACE Facet
                //its value is always 'collapse' and cannot be reset by user

                if ( value != null && !(base instanceof StringDatatypeValidator) ) {
                    if ( !value.equals(SchemaSymbols.ATT_COLLAPSE) )
                        throw new InvalidDatatypeFacetException( "whiteSpace value '" + value +
                                                                 "' for this type must be 'collapse'.");
                    facets.remove(SchemaSymbols.ELT_WHITESPACE);
                }

                Class validatorDef = base.getClass();
View Full Code Here

Examples of org.apache.xerces.validators.datatype.InvalidDatatypeFacetException

            if ( fDebug ) {
                System.out.println("!! The original error message is: " + e.getTargetException().getMessage() );
                e.getTargetException().printStackTrace();
            }
            else {
                throw new InvalidDatatypeFacetException( e.getTargetException().getMessage() );
            }
        }
        return validator;
    }
View Full Code Here

Examples of org.apache.xerces.validators.datatype.InvalidDatatypeFacetException

        } catch (InvocationTargetException e) {
            if ( fDebug ){
                System.out.println("!! The original error message is: " + e.getTargetException().getMessage() );
                e.getTargetException().printStackTrace();
            } else {
                 throw new InvalidDatatypeFacetException( e.getTargetException().getMessage() );
                //System.out.println("Exception: " + e.getTargetException
                //validator = null;
            }
        }
        return validator;
View Full Code Here

Examples of org.apache.xerces.validators.datatype.InvalidDatatypeFacetException

                //for all datatypes other than string, we don't pass WHITESPACE Facet
                //its value is always 'collapse' and cannot be reset by user

                if ( value != null && !(base instanceof StringDatatypeValidator) ) {
                    if ( !value.equals(SchemaSymbols.ATT_COLLAPSE) )
                        throw new InvalidDatatypeFacetException( "whiteSpace value '" + value +
                                                                 "' for this type must be 'collapse'.");
                    facets.remove(SchemaSymbols.ELT_WHITESPACE);
                }

                Class validatorDef = base.getClass();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.