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

org.mule.registry.ValidationException Maven / Gradle / Ivy

The newest version!
/*
 * $Id: ValidationException.java 7976 2007-08-21 14:26:13Z dirk.olmes $
 * --------------------------------------------------------------------------------------
 * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
 *
 * The software in this package is published under the terms of the CPAL v1.0
 * license, a copy of which has been included with this distribution in the
 * LICENSE.txt file.
 */

package org.mule.registry;

import org.mule.config.i18n.MessageFactory;
import org.mule.util.SystemUtils;

import java.util.Iterator;
import java.util.List;

/**
 * Is thrown when an object loaded from a descriptor is invalid
 * 
 * @author Ross Mason
 * @version $Revision: 7976 $
 */
public class ValidationException extends RegistryException
{
    /**
     * Serial version
     */
    private static final long serialVersionUID = -8798792301579785598L;

    public ValidationException(String vaildationError)
    {
        super(MessageFactory.createStaticMessage(vaildationError));
    }

    public ValidationException(List vaildationErrors)
    {
        this(createMessage(vaildationErrors));
    }

    private static String createMessage(List vaildationErrors)
    {
        // TODO i18n
        StringBuffer buf = new StringBuffer();
        buf.append("The following validation errors occurred");
        for (Iterator iterator = vaildationErrors.iterator(); iterator.hasNext();)
        {
            String s = (String)iterator.next();
            buf.append(SystemUtils.LINE_SEPARATOR).append(s);
        }
        return buf.toString();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy