org.fabric3.introspection.validation.InvalidContributionException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fabric3-introspection-spi Show documentation
Show all versions of fabric3-introspection-spi Show documentation
Fabric3 SPIs for component introspection.
The newest version!
/*
* Fabric3
* Copyright ? 2008 Metaform Systems Limited
*
* This proprietary software may be used only connection with the Fabric3 license
* (the ?License?), a copy of which is included in the software or may be
* obtained at: http://www.metaformsystems.com/licenses/license.html.
* Software distributed under the License is distributed on an ?as is? basis,
* without warranties or conditions of any kind. See the License for the
* specific language governing permissions and limitations of use of the software.
* This software is distributed in conjunction with other software licensed under
* different terms. See the separate licenses for those programs included in the
* distribution for the permitted and restricted uses of such software.
*
*/
package org.fabric3.introspection.validation;
import java.util.List;
import java.util.ArrayList;
import java.io.ByteArrayOutputStream;
import java.io.PrintWriter;
import org.fabric3.host.contribution.ValidationException;
import org.fabric3.host.contribution.ValidationFailure;
/**
* @version $Revision$ $Date$
*/
public class InvalidContributionException extends ValidationException {
private static final long serialVersionUID = -5729273092766880963L;
/**
* Constructor.
*
* @param errors the errors that were found during validation
* @param warnings the warnings that were found during validation
*/
public InvalidContributionException(List errors, List warnings) {
super(errors, warnings);
}
/**
* Constructor.
*
* @param errors the errors that were found during validation
*/
public InvalidContributionException(List errors) {
super(errors, new ArrayList());
}
public String getMessage() {
ByteArrayOutputStream bas = new ByteArrayOutputStream();
PrintWriter writer = new PrintWriter(bas);
if (!getErrors().isEmpty()) {
ValidationUtils.writeErrors(writer, getErrors());
writer.write("\n");
}
if (!getWarnings().isEmpty()) {
ValidationUtils.writeWarnings(writer, getWarnings());
}
return bas.toString();
}
}