1 17 package org.apache.servicemix.jbi; 18 19 import javax.jbi.messaging.Fault; 20 import javax.jbi.messaging.MessageExchange; 21 import javax.jbi.messaging.MessagingException; 22 23 28 public class FaultException extends MessagingException { 29 private MessageExchange exchange; 30 private Fault fault; 31 32 public static FaultException newInstance(MessageExchange exchange) throws NoFaultAvailableException { 33 Fault fault = exchange.getFault(); 34 if (fault == null) { 35 throw new NoFaultAvailableException(exchange); 36 } 37 else { 38 return new FaultException("Fault occurred invoking server: " + fault, exchange, fault); 39 } 40 } 41 42 public FaultException(String text, MessageExchange exchange, Fault fault) { 43 super(text); 44 this.exchange = exchange; 45 this.fault = fault; 46 } 47 48 public MessageExchange getExchange() { 49 return exchange; 50 } 51 52 public Fault getFault() { 53 return fault; 54 } 55 56 } 57 | Popular Tags |