Commit 7c7741d8 authored by Nicola Fulvio Calabria's avatar Nicola Fulvio Calabria
Browse files

Correct DuplicateNodeException thrown when destination of copy already

exists
parent a66d218b
......@@ -7,6 +7,7 @@ package it.inaf.oats.vospace;
import it.inaf.ia2.aa.data.User;
import it.inaf.oats.vospace.datamodel.NodeUtils;
import it.inaf.oats.vospace.exception.DuplicateNodeException;
import it.inaf.oats.vospace.exception.NodeBusyException;
import it.inaf.oats.vospace.exception.NodeNotFoundException;
import it.inaf.oats.vospace.exception.PermissionDeniedException;
......@@ -15,6 +16,7 @@ import java.util.List;
import java.util.Optional;
import net.ivoa.xml.vospace.v2.Transfer;
import org.springframework.dao.CannotSerializeTransactionException;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.transaction.annotation.Isolation;
......@@ -90,6 +92,8 @@ public class CopyService extends AbstractNodeService {
} catch (CannotSerializeTransactionException ex) {
// Concurrent transactions attempted to modify this set of nodes
throw new NodeBusyException(sourcePath);
} catch (DuplicateKeyException ex) {
throw new DuplicateNodeException(destinationCopyRoot);
}
return List.of(sourcePath, destinationCopyRoot);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment