01: /*
02: * $Id: ExceptionHolder.java 10489 2008-01-23 17:53:38Z dfeist $
03: * --------------------------------------------------------------------------------------
04: * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
05: *
06: * The software in this package is published under the terms of the CPAL v1.0
07: * license, a copy of which has been included with this distribution in the
08: * LICENSE.txt file.
09: */
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: /** TODO */
18: public class ExceptionHolder implements ExceptionListener {
19: private List exceptions = new ArrayList(2);
20:
21: public void exceptionThrown(Exception e) {
22: exceptions.add(e);
23: }
24:
25: public List getExceptions() {
26: return exceptions;
27: }
28:
29: public boolean isExceptionThrown() {
30: return exceptions.size() > 0;
31: }
32:
33: public void clear() {
34: exceptions.clear();
35: }
36:
37: public void print() {
38: for (Iterator iterator = exceptions.iterator(); iterator
39: .hasNext();) {
40: Exception exception = (Exception) iterator.next();
41: exception.printStackTrace();
42: }
43: }
44: }
|