1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule.registry; |
12 | |
|
13 | |
import org.mule.config.i18n.MessageFactory; |
14 | |
import org.mule.util.SystemUtils; |
15 | |
|
16 | |
import java.util.Iterator; |
17 | |
import java.util.List; |
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
public class ValidationException extends RegistryException |
26 | |
{ |
27 | |
|
28 | |
|
29 | |
|
30 | |
private static final long serialVersionUID = -8798792301579785598L; |
31 | |
|
32 | |
public ValidationException(String vaildationError) |
33 | |
{ |
34 | 0 | super(MessageFactory.createStaticMessage(vaildationError)); |
35 | 0 | } |
36 | |
|
37 | |
public ValidationException(List vaildationErrors) |
38 | |
{ |
39 | 0 | this(createMessage(vaildationErrors)); |
40 | 0 | } |
41 | |
|
42 | |
private static String createMessage(List vaildationErrors) |
43 | |
{ |
44 | |
|
45 | 0 | StringBuffer buf = new StringBuffer(); |
46 | 0 | buf.append("The following validation errors occurred"); |
47 | 0 | for (Iterator iterator = vaildationErrors.iterator(); iterator.hasNext();) |
48 | |
{ |
49 | 0 | String s = (String)iterator.next(); |
50 | 0 | buf.append(SystemUtils.LINE_SEPARATOR).append(s); |
51 | |
} |
52 | 0 | return buf.toString(); |
53 | |
} |
54 | |
} |