View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.example.errorhandler.handlers;
8   
9   import org.mule.api.lifecycle.FatalException;
10  import org.mule.example.errorhandler.ErrorMessage;
11  import org.mule.example.errorhandler.HandlerException;
12  import org.mule.example.errorhandler.LocaleMessage;
13  import org.mule.util.StringMessageUtils;
14  
15  import org.apache.commons.logging.Log;
16  import org.apache.commons.logging.LogFactory;
17  
18  /**
19   * <code>FatalBehaviour</code> TODO (document class)
20   */
21  public class FatalHandler extends DefaultHandler
22  {
23      /** logger used by this class */
24      private static final Log logger = LogFactory.getLog(FatalHandler.class);
25  
26      public FatalHandler()
27      {
28          super();
29          registerException(FatalException.class);
30      }
31  
32      public void processException(ErrorMessage message, Throwable t) throws HandlerException
33      {
34          String msg = LocaleMessage.fatalHandlerMessage();
35          System.out.println(StringMessageUtils.getBoilerPlate(msg));
36          logger.fatal(LocaleMessage.fatalHandlerException(t), t);
37      }
38  }