1   /*
2    * $Id: TestingWorkListener.java 11362 2008-03-14 11:27:59Z tcarlson $
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 CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.tck;
12  
13  import org.mule.work.DefaultWorkListener;
14  
15  import javax.resource.spi.work.WorkEvent;
16  
17  public class TestingWorkListener extends DefaultWorkListener
18  {
19      protected void handleWorkException(WorkEvent event, String type)
20      {
21          super.handleWorkException(event, type);
22          if (event.getException() != null)
23          {
24              Throwable t = event.getException().getCause();
25              if (t != null)
26              {
27  
28                  if (t instanceof Error)
29                  {
30                      throw (Error)t;
31                  }
32                  else if (t instanceof RuntimeException)
33                  {
34                      throw (RuntimeException)t;
35                  }
36              }
37  
38          }
39      }
40  }