From 3979da000f39607b1b2eaf5ec09a4b5077c09c86 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Thu, 9 Sep 2021 12:53:22 +0200 Subject: [PATCH] fix compare sourceId with destId --- .../transport/backend/operation/SoftCopyOperator.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/gcube/contentmanagement/blobstorage/transport/backend/operation/SoftCopyOperator.java b/src/main/java/org/gcube/contentmanagement/blobstorage/transport/backend/operation/SoftCopyOperator.java index 4f89fa3..77b587d 100644 --- a/src/main/java/org/gcube/contentmanagement/blobstorage/transport/backend/operation/SoftCopyOperator.java +++ b/src/main/java/org/gcube/contentmanagement/blobstorage/transport/backend/operation/SoftCopyOperator.java @@ -108,8 +108,10 @@ public class SoftCopyOperator extends SoftCopy { String destId=dest.getId().toString(); logger.debug("destination id is "+destId); // in this case the source and dest are the same object - if(sourceId.equals(destId)) + if(sourceId.toString().equals(destId)) { + logger.info("source and destination are pointing to the same object. The copy operation will have no effects"); return destId; + } // remove the destination file. The third parameter to true replace the file otherwise the remote id is returned if(resource.isReplace()){ removedId = mongoPrimaryInstance.removeFile(resource, null, resource.isReplace(), null, dest);