KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > registry > ValidationException


1 /*
2  * $Id: ValidationException.java 3798 2006-11-04 04:07:14Z aperepel $
3  * --------------------------------------------------------------------------------------
4  * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
5  *
6  * The software in this package is published under the terms of the MuleSource MPL
7  * license, a copy of which has been included with this distribution in the
8  * LICENSE.txt file.
9  */

10
11 package org.mule.registry;
12
13 import org.apache.commons.lang.SystemUtils;
14 import org.mule.config.i18n.Message;
15
16 import java.util.Iterator JavaDoc;
17 import java.util.List JavaDoc;
18
19 /**
20  * Is thrown when an object loaded from a descriptor is invalid
21  *
22  * @author <a HREF="mailto:ross.mason@symphonysoft.com">Ross Mason</a>
23  * @version $Revision: 3798 $
24  */

25 public class ValidationException extends RegistryException
26 {
27     /**
28      * Serial version
29      */

30     private static final long serialVersionUID = -8798792301579785598L;
31
32     public ValidationException(String JavaDoc vaildationError)
33     {
34         super(Message.createStaticMessage(vaildationError));
35     }
36
37     public ValidationException(List JavaDoc vaildationErrors)
38     {
39         this(createMessage(vaildationErrors));
40     }
41
42     private static String JavaDoc createMessage(List JavaDoc vaildationErrors)
43     {
44         // TODO i18n
45
StringBuffer JavaDoc buf = new StringBuffer JavaDoc();
46         buf.append("The following validation errors occurred");
47         for (Iterator JavaDoc iterator = vaildationErrors.iterator(); iterator.hasNext();)
48         {
49             String JavaDoc s = (String JavaDoc)iterator.next();
50             buf.append(SystemUtils.LINE_SEPARATOR).append(s);
51         }
52         return buf.toString();
53     }
54 }
55
Popular Tags