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 | 0 | public class ExceptionHolder implements ExceptionListener |
19 | |
{ |
20 | 0 | private List exceptions = new ArrayList(2); |
21 | |
|
22 | |
public void exceptionThrown(Exception e) |
23 | |
{ |
24 | 0 | exceptions.add(e); |
25 | 0 | } |
26 | |
|
27 | |
public List getExceptions() |
28 | |
{ |
29 | 0 | return exceptions; |
30 | |
} |
31 | |
|
32 | |
public boolean isExceptionThrown() |
33 | |
{ |
34 | 0 | return exceptions.size() > 0; |
35 | |
} |
36 | |
|
37 | |
public void clear() |
38 | |
{ |
39 | 0 | exceptions.clear(); |
40 | 0 | } |
41 | |
|
42 | |
public void print() |
43 | |
{ |
44 | 0 | for (Iterator iterator = exceptions.iterator(); iterator.hasNext();) |
45 | |
{ |
46 | 0 | Exception exception = (Exception) iterator.next(); |
47 | 0 | exception.printStackTrace(); |
48 | 0 | } |
49 | 0 | } |
50 | |
} |