Package javax.validation

Examples of javax.validation.ConstraintViolationException


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


          }
        }else{
          throw new UnauthenticatedException();
        }
      }else{
        throw new ConstraintViolationException(new HashSet<ConstraintViolation<?>>());
      }
    }
View Full Code Here

        Set<ConstraintViolation<T>> violations = AccessController.doPrivileged(
                J2DoPrivHelper.validateAction(_validator, arg0, getValidationGroup(event)));

        if (violations != null && violations.size() > 0) {
            return new ValidationException(
                new ConstraintViolationException(
                    // A validation constraint failure occurred for class "{0}".
                    _loc.get("validate-failed",
                        arg0.getClass().getName()).getMessage(),
                    (Set)violations),
                true);
View Full Code Here

        Set<ConstraintViolation<T>> violations =
            _validator.validateProperty(arg0, property,
                getValidationGroup(event));
        if (violations != null && violations.size() > 0) {
            return new ValidationException(
                new ConstraintViolationException(
                    // A validation constraint failure occurred for
                    // property "{1}" in class "{0}".
                    _loc.get("valdiate-property-failed",
                        arg0.getClass().getName(),property).getMessage(),
                    (Set)violations),
View Full Code Here

        Set<ConstraintViolation<T>> violations =
            _validator.validateValue(arg0, arg1, arg2,
                getValidationGroup(event));
        if (violations != null && violations.size() > 0) {
            return new ValidationException(
                new ConstraintViolationException(
                    // A validation constraint failure occurred for
                    // value "{2}" of property "{1}" in class "{0}".
                    _loc.get("validate-value-failed", arg0.getClass().getName(),
                        arg1, arg2.toString()).getMessage(),                   
                    (Set)violations),
View Full Code Here

        SFSB1 sfsb1 = lookup("SFSB1", SFSB1.class);
        try {
            sfsb1.createEmployee("name", null, 2);
            fail("should of thrown validation error for null address in Employee entity");
        } catch (Throwable throwable) {
            ConstraintViolationException constraintViolationException = null;
            // find the ConstraintViolationException
            while(throwable != null && ! (throwable instanceof ConstraintViolationException)) {
                throwable = throwable.getCause();
            }
            // should be null or instanceof ConstraintViolationException
View Full Code Here

              if (errorBuffer.length() > 0) {
                errorBuffer.insert(0, "\r\n");
                errorBuffer.insert(errorBuffer.length(), "\r\n");
              }

              throw new ConstraintViolationException(bundle.getString("management-validation-constraint-violation"
                    , managedType.getType().getCanonicalName(), propertyName, errorBuffer.toString())
                  , (Set<ConstraintViolation<?>>) violations);
            }
          } else {
            logger.warn(bundle.getString("management-validation-validator-not-found"));
View Full Code Here

        try {
            gamesManager.addSportMan("I lose", "EN");
            fail("no space should be in names");
        } catch (EJBException wrappingException) {
            assertTrue(wrappingException.getCause() instanceof ConstraintViolationException);
            ConstraintViolationException exception = ConstraintViolationException.class.cast(wrappingException.getCausedByException());
            assertEquals(1, exception.getConstraintViolations().size());
        }
    }
View Full Code Here

        try {
            gamesManager.addSportMan("ILoseTwo", "TOO-LONG");
            fail("country should be between 2 and 4 characters");
        } catch (EJBException wrappingException) {
            assertTrue(wrappingException.getCause() instanceof ConstraintViolationException);
            ConstraintViolationException exception = ConstraintViolationException.class.cast(wrappingException.getCausedByException());
            assertEquals(1, exception.getConstraintViolations().size());
        }
    }
View Full Code Here

        try {
            poleVaultingManager.points(119);
            fail("the jump is too short");
        } catch (EJBException wrappingException) {
            assertTrue(wrappingException.getCause() instanceof ConstraintViolationException);
            ConstraintViolationException exception = ConstraintViolationException.class.cast(wrappingException.getCausedByException());
            assertEquals(1, exception.getConstraintViolations().size());
        }
    }
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.