Examples of ValidatorException


Examples of javax.faces.validator.ValidatorException

       
        if (intValue > max)
        {
          if (min == Integer.MIN_VALUE)//the default...
          {
             throw new ValidatorException
                        (_getNotInRangeMessage(context, component, value, IntegerUtils.getString(min), IntegerUtils.getString(max)));
          }
          else
          {
             throw new ValidatorException
                        (_getMaximumMessage(context, component, value, IntegerUtils.getString(max)));
          }
        }

        if (intValue < min)
        {
          if (max == Integer.MAX_VALUE)//the default...
          {
            throw new ValidatorException
                        (_getNotInRangeMessage(context, component, value, IntegerUtils.getString(min), IntegerUtils.getString(max)));
          }
          else
          {
            FacesMessage msg = _getMinimumMessage(context, component, value, IntegerUtils.getString(min));
            throw new ValidatorException(msg);
          }
        }
      }
      else
      {
View Full Code Here

Examples of javax.faces.validator.ValidatorException

       
        if (longValue > max)
        {
          if (min == Long.MIN_VALUE)//the default...
          {
             throw new ValidatorException
                        (_getNotInRangeMessage(context, component, value, IntegerUtils.getString(min), IntegerUtils.getString(max)));
          }
          else
          {
             throw new ValidatorException
                        (_getMaximumMessage(context, component, value, IntegerUtils.getString(max)));
          }
        }

        if (longValue < min)
        {
          if (max == Long.MAX_VALUE)//the default...
          {
            throw new ValidatorException
                        (_getNotInRangeMessage(context, component, value, IntegerUtils.getString(min), IntegerUtils.getString(max)));
          }
          else
          {
            FacesMessage msg = _getMinimumMessage(context, component, value, IntegerUtils.getString(min));
            throw new ValidatorException(msg);
          }
        }
      }
      else
      {
View Full Code Here

Examples of javax.faces.validator.ValidatorException

      int maxBytes = getMaximum();
      try
      {
        byte[] bytes = theValue.getBytes(getEncoding());
        if (bytes.length > maxBytes)
          throw new ValidatorException(
            getLengthValidationFailureMessage(context, component, theValue));

      }
      catch (UnsupportedEncodingException uee)
      {
View Full Code Here

Examples of javax.faces.validator.ValidatorException

      String theValue = (String)value;
      Matcher matcher = _compiled.matcher(theValue);
      // the matched string has to be the same as the input
      if (! matcher.matches())
      {
        throw new ValidatorException(_getNoMatchFoundMessage(context,
                                                             component,
                                                             theValue));
      }
    }
  }
View Full Code Here

Examples of javax.faces.validator.ValidatorException

    }

    ValidatorException createValidatorException(
            String violationSummaryMessage, String violationDetailMessage, FacesMessage.Severity severity)
    {
        return new ValidatorException(
                ExtValUtils.createFacesMessage(severity, violationSummaryMessage, violationDetailMessage));
    }
View Full Code Here

Examples of javax.faces.validator.ValidatorException

        String labeledMessageSummary = bvmi.createLabeledMessage(violationMessage, false);
        String labeledMessageDetail = bvmi.createLabeledMessage(violationMessage, true);

        FacesMessage.Severity severity = bvmi.calcSeverity(violation);

        ValidatorException validatorException = bvmi
                .createValidatorException(labeledMessageSummary, labeledMessageDetail, severity);

        if (!bvmi.executeAfterThrowingInterceptors(uiComponent, convertedObject, validatorException))
        {
            return null;
        }

        if (bvmi.isMessageTextUnchanged(validatorException, labeledMessageSummary, labeledMessageDetail))
        {
            return ExtValUtils.createFacesMessage(severity, violationMessage, violationMessage);
        }
        else
        {
            return ExtValUtils.createFacesMessage(severity,
                    validatorException.getFacesMessage().getSummary(),
                    validatorException.getFacesMessage().getDetail());
        }
    }
View Full Code Here

Examples of javax.faces.validator.ValidatorException

            try {
                int converted = intValue(value);
                if (maximumSet &&
                    (converted > maximum)) {
        if (minimumSet) {
                        throw new ValidatorException(MessageFactory.getMessage
             (context,
              Validator.NOT_IN_RANGE_MESSAGE_ID,
              new Object[] {
            new Integer(minimum),
            new Integer(maximum) }));
     
        }
        else {
                        throw new ValidatorException(MessageFactory.getMessage
             (context,
              LongRangeValidator.MAXIMUM_MESSAGE_ID,
              new Object[] {
            new Integer(maximum) }));
        }
                }
                if (minimumSet &&
                    (converted < minimum)) {
        if (maximumSet) {
                        throw new ValidatorException(MessageFactory.getMessage
             (context,
              Validator.NOT_IN_RANGE_MESSAGE_ID,
              new Object[] {
            new Double(minimum),
            new Double(maximum) }));
     
        }
        else {
                        throw new ValidatorException(MessageFactory.getMessage
             (context,
              LongRangeValidator.MINIMUM_MESSAGE_ID,
              new Object[] {
            new Integer(minimum) }));
        }
                }
            } catch (NumberFormatException e) {
                throw new ValidatorException(MessageFactory.getMessage
                                     (context, LongRangeValidator.TYPE_MESSAGE_ID));
            }
        }

    }
View Full Code Here

Examples of javax.faces.validator.ValidatorException

            {
                return;
        }
        Object[] args = {value.toString()};
        if(!GenericValidator.matchRegexp(value.toString(),"^"+getPattern()+"$")){
            throw new ValidatorException(getFacesMessage(REGEXPR_MESSAGE_ID, args));
        }
    }
View Full Code Here

Examples of javax.faces.validator.ValidatorException

        if (null != comparator)
        {
            if (false == validateOperatorOnComparisonResult(operator, comparator.compare(value, foreignValue)))
            {
                throw new ValidatorException(MessageUtils.getMessage(FacesMessage.SEVERITY_ERROR, message, args));
            }
        }
        else if ( (value instanceof Comparable) && (foreignValue instanceof Comparable) )
        {
            try
            {
                if (false == validateOperatorOnComparisonResult(operator, ((Comparable)value).compareTo(foreignValue)))
                {
                    throw new ValidatorException(MessageUtils.getMessage(FacesMessage.SEVERITY_ERROR, message, args));
                }
            }
            catch (RuntimeException exception)
            {
                if (exception instanceof ValidatorException)
                {
                    throw exception;
                }
                else
                {
                    throw new ValidatorException(MessageUtils.getMessage(FacesMessage.SEVERITY_ERROR, message + ": " + exception.getLocalizedMessage(), args));
                }
            }
        }
        else if (value instanceof Comparable)
        {
View Full Code Here

Examples of javax.faces.validator.ValidatorException

            if (!isbnValidator.isValid( value.toString())) {
                Object[] args = {value.toString()};
                String message = getMessage();
                if (null == messagemessage = ISBN_MESSAGE_ID;

                throw new ValidatorException(MessageUtils.getMessage(FacesMessage.SEVERITY_ERROR, message, args));
            }
           

    }
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.