1
2
3
4
5
6
7
8
9
10 package org.mule.util;
11
12 import java.beans.ExceptionListener;
13 import java.util.ArrayList;
14 import java.util.Iterator;
15 import java.util.List;
16
17
18 public class ExceptionHolder implements ExceptionListener
19 {
20 private List exceptions = new ArrayList(2);
21
22 public void exceptionThrown(Exception e)
23 {
24 exceptions.add(e);
25 }
26
27 public List getExceptions()
28 {
29 return exceptions;
30 }
31
32 public boolean isExceptionThrown()
33 {
34 return exceptions.size() > 0;
35 }
36
37 public void clear()
38 {
39 exceptions.clear();
40 }
41
42 public void print()
43 {
44 for (Iterator iterator = exceptions.iterator(); iterator.hasNext();)
45 {
46 Exception exception = (Exception) iterator.next();
47 exception.printStackTrace();
48 }
49 }
50 }