[ http://jira.nuxeo.org/browse/NXP-2880?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46894#action_46894 ]
Florent Guillaume commented on NXP-2880: ---------------------------------------- Our types injected into JCR by default don't allow same name siblings. I'm not sure why they would be allowed in the tests. > CoreSession.move crash when the target folder already has a document with the > same local id (using the JCR backend) > ------------------------------------------------------------------------------------------------------------------- > > Key: NXP-2880 > URL: http://jira.nuxeo.org/browse/NXP-2880 > Project: Nuxeo Enterprise Platform > Issue Type: Bug > Components: Core > Affects Versions: 5.1.6, 5.2 M3 > Reporter: Olivier Grisel > Assignee: Olivier Grisel > Priority: Critical > Fix For: 5.1.7, 5.2 M4 > > Original Estimate: 4 hours > Remaining Estimate: 4 hours > > Step to reproduce: > - create two workspace (with title "Workspace 1" and "Workspace 2"). > - in each workspace create a document with identical titles "My Document" > - try to move document from workspace 2 to workspace 1 > JCRSession.move does not test whether a document already exist with the same > path and we get the following stacktrace: > Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: > org.nuxeo.ecm.core.api.DocumentException. message: Could not move the > document to /domain/workspaces/workspace-1 > at > org.nuxeo.ecm.core.repository.jcr.JCRSession.move(JCRSession.java:345) > at > org.nuxeo.ecm.core.api.AbstractSession.move(AbstractSession.java:503) > ... 209 more > Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: > javax.jcr.ItemExistsException. message: > /ecm:root/ecm:children/domain/ecm:children/workspaces/ecm:children/workspace-1/ecm:children/my-document > at org.apache.jackrabbit.core.SessionImpl.move(SessionImpl.java:971) > at > org.nuxeo.ecm.core.repository.jcr.JCRSession.move(JCRSession.java:342) > ... 210 more > Proposed solution is to add test and generate a new local id if necessary as > done in JCRSession.copy: > // test whether source document and naive target document have > // conflicting JCR paths > String dstPath = ((JCRDocument) dstContainer).getNode().getPath() > + '/' + ModelAdapter.getChildPath(dstName); > if (dstContainer.hasChild(dstName)) { > // we have a conflict, generate a new locally unique name > based > // on the title of the document > dstName = generateDocumentName(src.getString("title")); > dstPath = ((JCRDocument) dstContainer).getNode().getPath() > + '/' + ModelAdapter.getChildPath(dstName); > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nuxeo.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira _______________________________________________ ECM-tickets mailing list ECM-tickets@lists.nuxeo.com http://lists.nuxeo.com/mailman/listinfo/ecm-tickets