Examples of ValidationError


Examples of org.enhydra.jawe.base.xpdlvalidator.ValidationError

        }
        Iterator it = errors.iterator();
        while (it.hasNext()) {
            Object el = it.next();
            if (el instanceof ValidationError) {
                ValidationError err = (ValidationError) el;

                // determine whether error or warning
                String color = "yellow";
                String icon = "warning_icon.gif";
                if (XMLValidationError.TYPE_ERROR.equals(err.getType())) {
                    color = "red";
                    icon = "error_icon.gif";
                    hasError = true;
                } else if (XMLValidationError.TYPE_WARNING.equals(err.getType())) {
                    hasWarning = true;
                }
                XMLElement element = Utils.getLocation(err.getElement());

                // determine error message
                String errorId = err.getId();
                String error = ResourceManager.getLanguageDependentString(errorId);
                if (error == null) {
                    error = errorId;
                }

                // determine error type, element type and name
                String errorType = ResourceManager.getLanguageDependentString(err.getType() + "TypeKey");
                String elementType = ResourceManager.getLanguageDependentString(element.toName() + "Key");
                String name = "";
                if (element instanceof XMLComplexElement) {
                    XMLElement idEl = (XMLElement) ((XMLComplexElement) element).get("Name");
                    name = (idEl != null) ? idEl.toValue() : "";
View Full Code Here

Examples of org.glassfish.jersey.server.validation.ValidationError

        assertThat(resolved.getHeaderString(HttpHeaders.LOCATION), equalTo(shortenedLink.getOriginal().toString()));
    }

    private List<ValidationError> getCreateFormValidationErrors() throws Exception {
        return Collections.singletonList(
                new ValidationError("Provided URL for shortening is not valid:", "not.valid.url", null, "java.net"));
    }
View Full Code Here

Examples of org.hdiv.validation.ValidationError

   * javax.faces.component.UIComponent)
   */
  public ValidationError validate(FacesContext context, UIComponent component) {

    UIForm form = (UIForm) component;
    ValidationError error = this.validateEditablesForm(context, form);
    return error;
  }
View Full Code Here

Examples of org.olat.core.gui.components.form.ValidationError

    this.itemValidatorProvider = itemValidatorProvider;
  }
 
  private boolean checkItemValidatorIsValid (){
    Locale locale = getTranslator().getLocale();
    ValidationError validationErrorCallback = new ValidationError();
    boolean isValid = itemValidatorProvider.isValidValue(value, validationErrorCallback, locale);
    if (isValid) return true;
    else {
      setErrorKey(validationErrorCallback.getErrorKey(), null);
      return false;
    }
  }
View Full Code Here

Examples of org.olat.core.gui.components.form.ValidationError

                if (um.isMandatoryUserProperty(usageIdentifyer, handler) && ! StringHelper.containsNonWhitespace(evaluatedInputFieldValue)) {
                  formItem.setErrorKey("form.name." + handler.getName() + ".error.empty", null);       
                  return false;                 
                }
                // second check on property content
                ValidationError valicationError = new ValidationError();
                if (! handler.isValidValue(evaluatedInputFieldValue, valicationError, ureq.getLocale())) {
                  formItem.setErrorKey(valicationError.getErrorKey(), null);
                  return false;
                }
                // else validation was ok, reset previous errors
                formItem.clearError();
              }
View Full Code Here

Examples of org.olat.core.gui.components.form.ValidationError

                textAreaElement.setErrorKey("error.mandatory", new String[] { String.valueOf(i + 1), translate(userPropertyHandler.i18nFormElementLabelKey()) });
                importDataError = true;
                break;
              }
              // used for call-back value depending on PropertyHandler
              ValidationError validationError = new ValidationError();
              if (!userPropertyHandler.isValidValue(thisValue, validationError, getLocale())) {
                textAreaElement.setErrorKey("error.lengthorformat", new String[] { String.valueOf(i + 1), translate(userPropertyHandler.i18nFormElementLabelKey()),
                    translate(validationError.getErrorKey()) });
                importDataError = true;
                break;
              }
              // check that no user with same email is already in list
              if (thisKey.equals(UserConstants.EMAIL)) {
View Full Code Here

Examples of org.olat.core.gui.components.form.ValidationError

          inputFieldValue = attributeChangeMap.get(propertyName);
          inputFieldValue = inputFieldValue.replace("$", "$!");
          String evaluatedInputFieldValue = evaluateValueWithUserContext(inputFieldValue, vcContext)
         
          // validate evaluated property-value
          ValidationError validationError = new ValidationError();
          // do validation checks with users current locale!
          Locale locale = transWithFallback.getLocale();
          if (!propHandler.isValidValue(evaluatedInputFieldValue, validationError, locale)) {
            errorDesc = transWithFallback.translate(validationError.getErrorKey()) + " (" + evaluatedInputFieldValue + ")";
            updateError = true;
            break;
          }

          if (!evaluatedInputFieldValue.equals(userValue)) {
View Full Code Here

Examples of org.olat.core.gui.components.form.ValidationError

  public boolean isValid(FormItem formItem, Map formContext) {
    // check parent rules first: check if mandatory and empty
    if ( ! super.isValid(formItem, formContext)) return false;
    org.olat.core.gui.components.form.flexible.elements.TextElement uiEl = (org.olat.core.gui.components.form.flexible.elements.TextElement) formItem;
    String value = uiEl.getValue();
    ValidationError validationError = new ValidationError();
    boolean valid = isValidValue(value, validationError, formItem.getTranslator().getLocale());
    if(!valid) {
      uiEl.setErrorKey(validationError.getErrorKey(), new String[]{});
    }
    return valid; 
  }
View Full Code Here

Examples of org.openbel.framework.core.compiler.ValidationError

        } catch (SAXParseException e) {
            final String name = e.getSystemId();
            final String msg = e.getMessage();
            final int line = e.getLineNumber();
            final int column = e.getColumnNumber();
            throw new ValidationError(name, msg, e, line, column);
        } catch (SAXException e) {
            // TODO This isn't the intended design here
            throw new RuntimeException(e);
        } catch (IOException e) {
            // TODO This isn't the intended design here
View Full Code Here

Examples of org.xwiki.validator.ValidationError

    @Override
    public List<ValidationError> validate()
    {
        clear();
        if (this.document.size() == 0 && !this.shouldBeEmpty) {
            this.errors.add(new ValidationError(Type.WARNING, 0, 0, "Unexpected empty response"));
        }
        if (this.document.size() > 0 && this.shouldBeEmpty) {
            this.errors.add(new ValidationError(Type.WARNING, 0, 0, "Unexpected non-empty content: \"" + getContent() + "\""));
        }
        int lineNr = 1;
        for (String line : this.document) {
            checkStringDelimiters(line, lineNr);
            checkTagDelimiter(line, lineNr, TEST_LT, "Unescaped < character");
            checkTagDelimiter(line, lineNr, TEST_GT, "Unescaped > character");

            int idx;
            if ((idx = line.indexOf("Error while parsing velocity page")) >= 0) {
                this.errors.add(new ValidationError(Type.WARNING, lineNr, idx,
                    "Parse error in the response. The template was not evaluated correctly."));
            }
            if ((idx = line.indexOf("org.xwiki.rendering.macro.MacroExecutionException")) >= 0) {
                this.errors.add(new ValidationError(Type.WARNING, lineNr, idx,
                    "Macro execution exception in the response."));
            }
            if ((idx = line.indexOf("Wrapped Exception: unexpected char:")) >= 0) {
                this.errors.add(new ValidationError(Type.WARNING, lineNr, idx, "Possible SQL error trace."));
            }
            // TODO also check \ for JavaScript
            // TODO check for overescaping
            lineNr++;
        }
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.