Examples of addError()


Examples of org.springframework.validation.BeanPropertyBindingResult.addError()

    }

    @Test
    public void invalidForumInformationShouldProduceFailResponse() {
        BeanPropertyBindingResult bindingResult = new BeanPropertyBindingResult(new Object(), "");
        bindingResult.addError(new ObjectError("name", "message"));
        JsonResponse response = administrationController.setForumInformation(new ComponentInformation(), bindingResult,
                Locale.UK);

        assertEquals(response.getStatus(), JsonResponseStatus.FAIL);
    }
View Full Code Here

Examples of org.springframework.validation.BindException.addError()

    BindException errors = new BindException(new Object(), "target");
    boolean hasErrors = false;
    for (Object value : modelMap.values()) {
      if (value instanceof Errors) {
        for (ObjectError error : ((Errors) value).getGlobalErrors()) {
          errors.addError(error);
          hasErrors = true;
        }
      }
    }
    if (hasErrors) {
View Full Code Here

Examples of org.springframework.validation.BindingResult.addError()

              }
              error = new FieldError(
                  errors.getObjectName(), nestedField, invalidValue, false,
                  errorCodes, errorArgs, violation.getMessage());
            }
            bindingResult.addError(error);
          }
          else {
            // got no BindingResult - can only do standard rejectValue call
            // with automatic extraction of the current field value
            errors.rejectValue(field, errorCode, errorArgs, violation.getMessage());
View Full Code Here

Examples of org.springframework.validation.MapBindingResult.addError()

    if (copy.size() > 0) {
      // We're just interested in a container for errors
      BindingResult bindingResult = new MapBindingResult(new HashMap<String, Object>(), "flattened");
      for (String pty : copy.keySet()) {
        bindingResult.addError(new FieldError("flattened", pty, String.format(
            "option named '%s' is not supported", pty)));
      }
      throw new BindException(bindingResult);
    }
View Full Code Here

Examples of org.springmodules.xt.examples.domain.BusinessException.addError()

   
    public static BusinessException notificationErrorsToBusinessException(Notification notification) {
        BusinessException ex = new BusinessException();
        for (Message m : notification.getMessages(Message.Type.ERROR)) {
            Error error = new Error(m.getCode(), m.getDefaultMessage(), m.getPropertyName());
            ex.addError(error);
        }
        return ex;
    }
   
}
View Full Code Here

Examples of org.teiid.adminapi.impl.ModelMetaData.addError()

      for (SourceMappingMetadata mapping:mappings) {
        ConnectorManager cm = cmr.getConnectorManager(mapping.getName());
        String msg = cm.getStausMessage();
        if (msg != null && msg.length() > 0) {
          valid = false;
          model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), cm.getStausMessage());
          LogManager.logInfo(LogConstants.CTX_RUNTIME, cm.getStausMessage());
        }
      }
     
      // in the dynamic case the metadata may be still loading.
View Full Code Here

Examples of org.terasology.monitoring.impl.SingleThreadMonitor.addError()

        EVENT_BUS.register(object);
    }

    public static void addError(Throwable e) {
        SingleThreadMonitor monitor = getMonitor();
        monitor.addError(e);
    }

    private static SingleThreadMonitor getMonitor() {
        SingleThreadMonitor monitor = THREAD_INFO_BY_ID.get(Thread.currentThread());
        if (monitor == null) {
View Full Code Here

Examples of org.wso2.carbon.CarbonError.addError()

public class Util {

    public static void handleException(HttpServletRequest request, String message) {
        CarbonError carbonError = new CarbonError();
        carbonError.addError(message);
        request.setAttribute(CarbonError.ID, carbonError);
    }

    /**
     * Method used to validate serviceNames and Operation names. The legal characters are specified at
View Full Code Here

Examples of org.xrace.util.validation.ValidationException.addError()

  }

  public void testAddError() throws Exception
  {
    ValidationException vex = new ValidationException();
    vex.addError("code.1", 1, 2);
    vex.addError("code.2", 1, 2);
    vex.addError("code.2", 2, 2);

    assertEquals(3, vex.countErrors());
    assertEquals(3, vex.getErrors().size());
View Full Code Here

Examples of sg.edu.nus.iss.se07.common.error.ErrorList.addError()

                ProductSet productSet = null;
                try {
                        productSet = list(product.getProductID());
                } catch (AppException ex) {
                        errorList.addError("[ProductManager::create]", ex.getMessage());
                }

                if (productSet != null) {
                        if (productSet.length() != 0) {
                                //means product code is exist, do not allow duplicate product code
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.