Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
VOSpace INAF
vospace-rest
Commits
137a929a
Commit
137a929a
authored
Sep 09, 2021
by
Nicola Fulvio Calabria
Browse files
Correct DuplicateNodeException thrown when destination of move already
exists
parent
7c7741d8
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/it/inaf/oats/vospace/MoveService.java
View file @
137a929a
...
...
@@ -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.InternalFaultException
;
import
it.inaf.oats.vospace.exception.NodeBusyException
;
import
it.inaf.oats.vospace.exception.NodeNotFoundException
;
...
...
@@ -15,6 +16,7 @@ import it.inaf.oats.vospace.persistence.NodeDAO.ShortNodeDescriptor;
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
;
...
...
@@ -105,6 +107,8 @@ public class MoveService extends AbstractNodeService {
}
catch
(
CannotSerializeTransactionException
ex
)
{
// Concurrent transactions attempted to modify this set of nodes
throw
new
NodeBusyException
(
sourcePath
);
}
catch
(
DuplicateKeyException
ex
)
{
throw
new
DuplicateNodeException
(
destinationPath
);
}
}
...
...
src/test/java/it/inaf/oats/vospace/CopyServiceTest.java
View file @
137a929a
...
...
@@ -11,7 +11,6 @@ import it.inaf.oats.vospace.exception.NodeNotFoundException;
import
it.inaf.oats.vospace.exception.PermissionDeniedException
;
import
it.inaf.oats.vospace.persistence.DataSourceConfigSingleton
;
import
it.inaf.oats.vospace.persistence.NodeDAO
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Optional
;
import
net.ivoa.xml.vospace.v2.Transfer
;
...
...
@@ -28,7 +27,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.dao.DuplicateKeyException
;
import
org.springframework.test.annotation.DirtiesContext
;
import
org.springframework.test.context.TestPropertySource
;
import
org.springframework.test.context.ContextConfiguration
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment