All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.dropwizard.configuration.ConfigurationValidationException Maven / Gradle / Ivy

The newest version!
package io.dropwizard.configuration;

import io.dropwizard.validation.ConstraintViolations;
import jakarta.validation.ConstraintViolation;

import java.util.Set;

/**
 * An exception thrown where there is an error validating a configuration object.
 */
public class ConfigurationValidationException extends ConfigurationException {
    private static final long serialVersionUID = 5325162099634227047L;

    /**
     * The constraint violation occurred during configuration validation.
     */
    private final Set> constraintViolations;

    /**
     * Creates a new ConfigurationException for the given path with the given errors.
     *
     * @param path      the bad configuration path
     * @param errors    the errors in the path
     * @param  the type of the root bean of a constraint violation
     */
    public  ConfigurationValidationException(String path, Set> errors) {
        super(path, ConstraintViolations.format(errors));
        this.constraintViolations = ConstraintViolations.copyOf(errors);
    }

    /**
     * Returns the set of constraint violations in the configuration.
     *
     * @return the set of constraint violations
     */
    public Set> getConstraintViolations() {
        return constraintViolations;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy