Package javax.validation

Examples of javax.validation.ConstraintViolationException


        try {
            mgrLB.foo(null);
            fail();
        } catch (Exception e) {
            assertTrue(e.getCause() instanceof ConstraintViolationException);
            ConstraintViolationException cvs = (ConstraintViolationException) e.getCause();
            assertEquals(1, cvs.getConstraintViolations().size());
        }
    }
View Full Code Here


            try {
                Validator validator = (Validator)beanContext.getJndiContext().lookup("comp/Validator");

                Set generalSet = validator.validate(activationSpec);
                if (!generalSet.isEmpty()) {
                    throw new ConstraintViolationException("Constraint violation for ActivationSpec " + activationSpecClass.getName(), generalSet);
                }
            } catch (NamingException e) {
                logger.debug("No Validator bound to JNDI context");
            }
View Full Code Here

        return returnedValue;
    }

    // just a simple EJBException for now
    private RuntimeException buildValidationException(Set<ConstraintViolation<?>> violations) {
        return new ConstraintViolationException(violations);
    }
View Full Code Here

                method,
                arguments,
                groups));

        if (!constraintViolations.isEmpty()) {
            throw new ConstraintViolationException("Validation error when calling method '"
                    + method
                    + "' with arguments "
                    + Arrays.deepToString(arguments), constraintViolations);
        }

        Object returnedValue = invocation.proceed();

        if (validate.validateReturnedValue()) {
            constraintViolations.addAll(methodValidator.validateReturnedValue(clazz, method, returnedValue, groups));
            if (!constraintViolations.isEmpty()) {
                throw new ConstraintViolationException("Method '"
                        + method
                        + "' returned a not valid value "
                        + returnedValue, constraintViolations);
            }
        }
View Full Code Here

            if (vanityUrl.isDefaultMapping()) {
                VanityUrl otherDefaultMapping = newDefaultMappings.put(
                        vanityUrl.getLanguage(), vanityUrl);
                if (otherDefaultMapping != null) {

                    throw new ConstraintViolationException(
                            "Two mappings are set as default for the same language: "
                                    + vanityUrl.getUrl() + " and "
                                    + otherDefaultMapping.getUrl()
                                    + " for language: "
                                    + vanityUrl.getLanguage(), null);
View Full Code Here

                                break;
                            }
                        }
                    }
                    if (!oldMatchWillBeDeleted) {
                        throw new ConstraintViolationException(
                                "URL Mapping already exists exception: vanityUrl="
                                        + vanityUrl.getUrl()
                                        + " to be set on node: "
                                        + contentNode.getPath()
                                        + " already found on "
View Full Code Here

            try {
                Validator validator = (Validator)beanContext.getJndiContext().lookup("comp/Validator");

                Set generalSet = validator.validate(activationSpec);
                if (!generalSet.isEmpty()) {
                    throw new ConstraintViolationException("Constraint violation for ActivationSpec " + activationSpecClass.getName(), generalSet);
                }
            } catch (NamingException e) {
                logger.debug("No Validator bound to JNDI context");
            }
View Full Code Here

  protected final void validate(E e) throws ConstraintViolationException {
    final Set<ConstraintViolation<E>> invalids = validateNoException(e);
    if(invalids != null && invalids.size() > 0) {
      final HashSet<ConstraintViolation<?>> bunk = new HashSet<ConstraintViolation<?>>(invalids.size());
      bunk.addAll(invalids);
      throw new ConstraintViolationException(bunk);
    }
  }
View Full Code Here

            all.addAll(invalids);
          }
        }
      }
      if(all.size() > 0) {
        throw new ConstraintViolationException(all);
      }
    }
  }
View Full Code Here

  protected final void validate(E e) throws ConstraintViolationException {
    final Set<ConstraintViolation<E>> invalids = validateNoException(e);
    if(invalids != null && invalids.size() > 0) {
      final HashSet<ConstraintViolation<?>> bunk = new HashSet<ConstraintViolation<?>>(invalids.size());
      bunk.addAll(invalids);
      throw new ConstraintViolationException(bunk);
    }
  }
View Full Code Here

TOP

Related Classes of javax.validation.ConstraintViolationException

Copyright © 2018 www.massapicom. 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.