public Object copyFault(Object fault, Operation sourceOperation, Operation targetOperation) { // Rename the parameters so we can more easily remember which direction we're going in. Operation fromOperation = targetOperation; Operation toOperation = sourceOperation; if (faultExceptionMapper == null) { return fault; } List<DataType> fts = fromOperation.getFaultTypes(); for (int i = 0; i < fts.size(); i++) { DataType et = fts.get(i); if (et.getPhysical().isInstance(fault)) { Throwable ex = (Throwable)fault; DataType<DataType> exType = findFaultDataType(fromOperation, fault); DataType faultType = getFaultType(exType); Object faultInfo = faultExceptionMapper.getFaultInfo(ex, faultType.getPhysical(), fromOperation); DataType targetExType = findSourceFaultDataType(toOperation, exType); DataType targetFaultType = getFaultType(targetExType); faultInfo = copy(faultInfo, faultType, targetFaultType, fromOperation, toOperation); fault = faultExceptionMapper.wrapFaultInfo(targetExType, ex.getMessage(), faultInfo, ex.getCause(), toOperation); return fault; } } return fault; }
public Object copyFault(Object fault, Operation sourceOperation, Operation targetOperation) { // Rename the parameters so we can more easily remember which direction we're going in. Operation fromOperation = targetOperation; Operation toOperation = sourceOperation; if (faultExceptionMapper == null) { return fault; } List<DataType> fts = fromOperation.getFaultTypes(); for (int i = 0; i < fts.size(); i++) { DataType et = fts.get(i); if (et.getPhysical().isInstance(fault)) { Throwable ex = (Throwable)fault; DataType<DataType> exType = findFaultDataType(fromOperation, fault); DataType faultType = getFaultType(exType); Object faultInfo = faultExceptionMapper.getFaultInfo(ex, faultType.getPhysical(), fromOperation); DataType targetExType = findSourceFaultDataType(toOperation, exType); DataType targetFaultType = getFaultType(targetExType); faultInfo = copy(faultInfo, faultType, targetFaultType, fromOperation, toOperation); fault = faultExceptionMapper.wrapFaultInfo(targetExType, ex.getMessage(), faultInfo, ex.getCause(), toOperation); return fault; } } return fault; }
DataType targetDataType = findFaultDataType(targetOperation, result); DataType targetFaultType = getFaultType(targetDataType);
DataType targetDataType = findFaultDataType(targetOperation, result); DataType targetFaultType = getFaultType(targetDataType);