diff --git a/source/java/org/alfresco/repo/replication/ReplicationActionExecutor.java b/source/java/org/alfresco/repo/replication/ReplicationActionExecutor.java index 7bf3fb4cb7..94759caef3 100644 --- a/source/java/org/alfresco/repo/replication/ReplicationActionExecutor.java +++ b/source/java/org/alfresco/repo/replication/ReplicationActionExecutor.java @@ -268,7 +268,8 @@ public class ReplicationActionExecutor extends ActionExecuterAbstractBase { { TransferEventError failureEndEvent = ((TransferFailureException)e).getErrorEvent(); writeDefinitionReports(replicationDef, failureEndEvent.getSourceReport(), failureEndEvent.getDestinationReport()); - throw new ReplicationServiceException("Error executing transfer - " + e.getCause().getMessage(), e); + Throwable cause = (e.getCause() == null) ? e : e.getCause(); + throw new ReplicationServiceException("Error executing transfer - " + cause.getMessage(), cause); } writeDefinitionReports(replicationDef, null, null); throw new ReplicationServiceException("Error executing transfer - " + e.getMessage(), e); diff --git a/source/java/org/alfresco/repo/transfer/TransferServiceImpl2.java b/source/java/org/alfresco/repo/transfer/TransferServiceImpl2.java index 94938ec229..69925046bb 100644 --- a/source/java/org/alfresco/repo/transfer/TransferServiceImpl2.java +++ b/source/java/org/alfresco/repo/transfer/TransferServiceImpl2.java @@ -728,9 +728,8 @@ public class TransferServiceImpl2 implements TransferService2 logger.debug("TransferException - unable to transfer", failureException); TransferEventError errorEvent = new TransferEventError(); errorEvent.setTransferState(TransferEvent.TransferState.ERROR); - TransferFailureException endException = new TransferFailureException(errorEvent); - errorEvent.setMessage(endException.getMessage()); - errorEvent.setException(endException); + errorEvent.setException(failureException); + errorEvent.setMessage(failureException.getMessage()); endEventImpl = errorEvent; } else if (cancelled) @@ -832,7 +831,7 @@ public class TransferServiceImpl2 implements TransferService2 if (endEvent instanceof TransferEventError) { TransferEventError endError = (TransferEventError)endEvent; - throw (TransferFailureException)endError.getException(); + throw new TransferFailureException(endError); } return endEvent; } @@ -1044,8 +1043,9 @@ public class TransferServiceImpl2 implements TransferService2 TransferStatus status = transferMonitoring.get(transferHandle); if(status != null) { - if(status.cancelMe) + if(!status.cancelInProgress && status.cancelMe) { + status.cancelInProgress = true; throw new TransferCancelledException(); } } @@ -1394,6 +1394,7 @@ public class TransferServiceImpl2 implements TransferService2 private class TransferStatus { boolean cancelMe = false; + boolean cancelInProgress = false; }