[
https://issues.apache.org/jira/browse/JCR-3955?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Pascal Knüppel updated JCR-3955:
--------------------------------
Description:
I tried to clone a shareable node into the same workspace. It worked with
TransientRepository but it does not with standalone-server. It happens that
both use different implementations:
TransienRepository uses:
{code:title=org.apache.jackrabbit.core.WorkspaceImpl.java|borderStyle=solid}
if (getName().equals(srcWorkspace)) {
// clone to same workspace is allowed for mix:shareable nodes,
// but only if removeExisting is false
if (!removeExisting) {
internalClone(srcAbsPath, destAbsPath);
return;
}
// same as current workspace
String msg = srcWorkspace + ": illegal workspace (same as current)";
log.debug(msg);
throw new RepositoryException(msg);
}
{code}
and standalone-server uses:
{code:title=org.apache.jackrabbit.jcr2spi.WorkspaceImpl.java|borderStyle=solid}
// check workspace name
if (getName().equals(srcWorkspace)) {
// same as current workspace
String msg = srcWorkspace + ": illegal workspace (same as current)";
log.debug(msg);
throw new RepositoryException(msg);
}
{code}
If I am not mistaken according to JSR-283 this should be allowed
----------------------------------------------------------------------------------------------------------------------------
14.1 Creation of Shared Nodes
Cloning a mix:shareable node into the same workspace is the standard way of
creating a shared node.
Given workspace W, and an existing mix:shareable node at /A/B/C, the call
W.clone(“W”, “/A/B/C”, “/X/Y/Z”, false)
will create a new node at /X/Y/Z that shares with /A/B/C.
Note that if the removeExisting flag is set to true, the Workspace.clone does
not create a shared node, but instead behaves identically to a Workspace.move.
----------------------------------------------------------------------------------------------------------------------------
was:
I tried to clone a shareable node into the same workspace. It worked with
TransientRepository but it does not with standalone-server. It happens that
both use different implementations:
TransienRepository uses:
{code:title=org.apache.jackrabbit.core.WorkspaceImpl.java|borderStyle=solid}
if (getName().equals(srcWorkspace)) {
// clone to same workspace is allowed for mix:shareable nodes,
// but only if removeExisting is false
if (!removeExisting) {
internalClone(srcAbsPath, destAbsPath);
return;
}
// same as current workspace
String msg = srcWorkspace + ": illegal workspace (same as current)";
log.debug(msg);
throw new RepositoryException(msg);
}
{code}
and standalone-server uses:
{code:title=org.apache.jackrabbit.jcr2spi.WorkspaceImpl.java|borderStyle=solid}
// check workspace name
if (getName().equals(srcWorkspace)) {
// same as current workspace
String msg = srcWorkspace + ": illegal workspace (same as current)";
log.debug(msg);
throw new RepositoryException(msg);
}
{code}
If I am not mistaken according to JSR-283 this should be allowed
----------------------------------------------------------------------------------------------------------------------------
14.1 Creation of Shared Nodes
Cloning a mix:shareable node into the same workspace is the standard way of
creating a shared node.
Given workspace W, and an existing mix:shareable node at /A/B/C, the call
W.clone(“W”, “/A/B/C”, “/X/Y/Z”, false)
will create a new node at /X/Y/Z that shares with /A/B/C.
----------------------------------------------------------------------------------------------------------------------------
Note that if the removeExisting flag is set to true, the Workspace.clone does
not create a shared node, but instead behaves identically to a Workspace.move.
> Cloning shareable Nodes into same workspace fails
> -------------------------------------------------
>
> Key: JCR-3955
> URL: https://issues.apache.org/jira/browse/JCR-3955
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Affects Versions: 2.12.1
> Reporter: Pascal Knüppel
>
> I tried to clone a shareable node into the same workspace. It worked with
> TransientRepository but it does not with standalone-server. It happens that
> both use different implementations:
> TransienRepository uses:
> {code:title=org.apache.jackrabbit.core.WorkspaceImpl.java|borderStyle=solid}
> if (getName().equals(srcWorkspace)) {
> // clone to same workspace is allowed for mix:shareable nodes,
> // but only if removeExisting is false
> if (!removeExisting) {
> internalClone(srcAbsPath, destAbsPath);
> return;
> }
> // same as current workspace
> String msg = srcWorkspace + ": illegal workspace (same as
> current)";
> log.debug(msg);
> throw new RepositoryException(msg);
> }
> {code}
> and standalone-server uses:
> {code:title=org.apache.jackrabbit.jcr2spi.WorkspaceImpl.java|borderStyle=solid}
> // check workspace name
> if (getName().equals(srcWorkspace)) {
> // same as current workspace
> String msg = srcWorkspace + ": illegal workspace (same as
> current)";
> log.debug(msg);
> throw new RepositoryException(msg);
> }
> {code}
> If I am not mistaken according to JSR-283 this should be allowed
> ----------------------------------------------------------------------------------------------------------------------------
> 14.1 Creation of Shared Nodes
> Cloning a mix:shareable node into the same workspace is the standard way of
> creating a shared node.
> Given workspace W, and an existing mix:shareable node at /A/B/C, the call
> W.clone(“W”, “/A/B/C”, “/X/Y/Z”, false)
> will create a new node at /X/Y/Z that shares with /A/B/C.
> Note that if the removeExisting flag is set to true, the Workspace.clone does
> not create a shared node, but instead behaves identically to a Workspace.move.
> ----------------------------------------------------------------------------------------------------------------------------
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)