package org.embulk.config; import java.util.Set; import javax.validation.ConstraintViolation; public class TaskValidationException extends RuntimeException { @SuppressWarnings("unchecked") private final Set violations; public TaskValidationException(Set> violations) { super(formatMessage(violations)); this.violations = violations; } public Set> getViolations() { return violations; } private static String formatMessage(Set> violations) { StringBuilder sb = new StringBuilder(); sb.append("Configuration task validation failed."); for(ConstraintViolation violation : violations) { sb.append(" "); sb.append(violation.getPropertyPath()); sb.append(" "); sb.append(violation.getMessage()); sb.append(" but got "); sb.append(violation.getInvalidValue()); } return sb.toString(); } }