1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 package org.apache.commons.pipeline.validation; 19 20 import java.util.List; 21 22 /** 23 * This exception is used to indicate that one or more validation errors 24 * have occurred during an operation. 25 * 26 */ 27 public class ValidationException extends java.lang.Exception { 28 /** 29 * 30 */ 31 private static final long serialVersionUID = 6179302502035580464L; 32 private List<ValidationFailure> errors; 33 34 /** 35 * Creates a new instance of <code>ValidationException</code> without detail message. 36 * @param errors the list of errors that caused the exception 37 */ 38 public ValidationException(List<ValidationFailure> errors) { 39 this.errors = errors; 40 } 41 42 43 /** 44 * Constructs an instance of <code>ValidationException</code> with the specified detail message. 45 * @param errors The list of errors that caused the exception 46 * @param msg the detail message. 47 */ 48 public ValidationException(String msg, List<ValidationFailure> errors) { 49 super(msg); 50 this.errors = errors; 51 } 52 53 /** 54 * Returns the list of errors that precipitated this validation exception. 55 * @return the list of errors that precipitated this validation exception. 56 */ 57 public List<ValidationFailure> getValidationErrors() { 58 return this.errors; 59 } 60 }