Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Won't Fix
-
0.9, 1.0, 1.0.1
-
None
-
None
Description
The failure to enforce the reserved status of the jcr namespace leads to at least one problem.
A versionable node can be created with properties jcr:frozenPrimaryType, jcr:frozenMixinTypes or jcr:frozenUuid. These clash with the meta-data properties used in the nt:frozenNode.
When the versionable is checked-in and then later restored, the corrupt frozen node can cause an exception. The following code demonstrates the problem:
<code>
Repository repository = new TransientRepository();
Session session = repository.login(new SimpleCredentials("username", "password".toCharArray()));
try {
Node root = session.getRootNode();
Node a = root.addNode("a", "nt:unstructured");
a.addMixin("mix:versionable");
a.setProperty("jcr:frozenMixinTypes", new String[]
);
session.save();
Version v = a.checkin();
a.checkout();
a.remove();
session.save();
root.restore(v, "a", true);
} finally
</code>
The solution is to enforce the reserved status of jcr (and nt, mix and xml, while we are at it). The rules should be:
1) A client cannot register a node type that uses reserved namespaces in either the name of the node type or in the name of any off its child item definitions.
2) A client cannot create a residual child item with a name that uses a reserved namespace. Clients can, of course, create an item with a reserved namespace if the item is defined in a built-in JCR node type.