Coverage Report - org.mule.example.errorhandler.BusinessErrorManager
 
Classes in this File Line Coverage Branch Coverage Complexity
BusinessErrorManager
0%
0/10
N/A
0
 
 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;
 8  
 
 9  
 import org.mule.api.MuleEventContext;
 10  
 import org.mule.api.MuleException;
 11  
 import org.mule.api.lifecycle.Callable;
 12  
 import org.mule.util.StringMessageUtils;
 13  
 
 14  
 import java.util.ArrayList;
 15  
 import java.util.List;
 16  
 
 17  
 import org.apache.commons.logging.Log;
 18  
 import org.apache.commons.logging.LogFactory;
 19  
 
 20  
 /**
 21  
  * The <code>BusinessErrorManager</code> is a Service that processes 
 22  
  * exceptions of type org.mule.example.errorhandler.exceptions.BusinessException.
 23  
  * The business method simply reports the errors and stops any further processing.
 24  
  */
 25  0
 public class BusinessErrorManager implements Callable
 26  
 {
 27  
     /** logger used by this class */
 28  0
     private static final Log logger = LogFactory.getLog(BusinessErrorManager.class);
 29  
 
 30  
     public Object onCall(MuleEventContext context) throws MuleException
 31  
     {
 32  0
         ErrorMessage msg = (ErrorMessage)context.getMessage().getPayload();
 33  
         // Do something with the error message
 34  0
         List<String> msgs = new ArrayList<String>();
 35  
 
 36  0
         msgs.add(LocaleMessage.businessErrorManagerError());
 37  0
         msgs.add(LocaleMessage.errorDetail(msg.getException().getDetailMessage()));
 38  0
         msgs.add(LocaleMessage.errorClass(msg.getException().getClass()));
 39  
 
 40  0
         logger.info("\n" + StringMessageUtils.getBoilerPlate(msgs, '*', 80));
 41  0
         context.setStopFurtherProcessing(true);
 42  0
         return null;
 43  
     }
 44  
 
 45  
 }