private Artifact validateArtifact ( Artifact artifact ) throws RepositoryManagerException { Set < ConstraintViolation < Artifact >> violations = validator . validate ( artifact ) ; if ( ! violations . isEmpty ( ) ) { throw new RepositoryManagerException ( "Repository manager returned invalid artifact: " + artifact . toString ( ) + " Constraint Violations: %s" , violations ) ; } return artifact ; }
Check artifact for any validation errors . If there are constraint violations then a RepositoryManagerException is thrown . Otherwise the artifact is returned .