Node with primary node type set to nt:unstructured (via json), overridden to
nt:folder
--------------------------------------------------------------------------------------
Key: SLING-545
URL: https://issues.apache.org/jira/browse/SLING-545
Project: Sling
Issue Type: Bug
Components: JCR
Affects Versions: JCR Contentloader 2.0.2
Environment: Ubuntu 8.04, Java 1.6
Reporter: Bryce Ewing
Priority: Minor
As stated in sample_readme.txt (in simple-demo):
Directories
-----------
Unless a node with the name of the directory already exists or has been defined
in an XML or JSON descriptor file (see below) a directory is created as a node
with the primary node type "nt:folder" in the repository.
I have the following structure in my content folder:
pages.json
pages/home.json
pages.json has:
{
"jcr:primaryType":"nt:unstructured",
"title" : "test"
}
home.json has:
{
"jcr:primaryType":"nt:unstructured"
}
When the bundle is loaded I get the following exception:
19.06.2008 15:54:44.971 *ERROR* [Background Updatenz.co.smx.sling.test (37)]
org.apache.sling.jcr.contentloader.internal.Loader Cannot load initial content
for bundle nz.co.smx.sling.test : no definition found in parent node's node
type for new node: no matching child node definition found for {}home
javax.jcr.nodetype.ConstraintViolationException: no definition found in parent
node's node type for new node: no matching child node definition found for
{}home: no matching child node definition found for {}home
at
org.apache.jackrabbit.core.NodeImpl.internalAddChildNode(NodeImpl.java:752)
at
org.apache.jackrabbit.core.NodeImpl.internalAddNode(NodeImpl.java:718)
at
org.apache.jackrabbit.core.NodeImpl.internalAddNode(NodeImpl.java:665)
at org.apache.jackrabbit.core.NodeImpl.addNode(NodeImpl.java:1987)
at
org.apache.sling.jcr.contentloader.internal.Loader.createNode(Loader.java:470)
at
org.apache.sling.jcr.contentloader.internal.Loader.createNode(Loader.java:416)
Having stepped through the loader code in the debugger I found the following:
Loader.java:361 - when pages.json is being processed
if (foundProvider) {
if (createNode(parent, getName(entry), file, overwrite,
versionables, checkin) != null) {
ignoreEntry.add(file);
continue;
}
}
Loader.java:324 - when pages directory is being processed
// if we have a descriptor, which has not been processed yet,
// otherwise call createFolder, which creates an nt:folder or
// returns an existing node (created by a descriptor)
Node node = null;
if (nodeDescriptor != null
&& !ignoreEntry.contains(nodeDescriptor)) {
node = createNode(parent, name, nodeDescriptor, overwrite,
versionables, checkin);
ignoreEntry.add(nodeDescriptor);
} else {
node = createFolder(parent, name, overwrite);
}
>From the first code fragment the pages node has the node type nt:unstructured
>but this is overridden to nt:folder in the second code fragment, which causes
>the home.json node to fail. When stepping through in the debugger in the
>second code fragment I removed the node descriptor from the ignoreEntry list
>and the content all loaded correctly, so I might wonder why it is being put in
>there in the first place (or whether the node from the first code fragment
>should be used in the second?).
Have created a patch, but for some reason I am not able to compile at the
moment, get:
org.apache.maven.reactor.MavenExecutionException: Cannot find parent:
org.apache.sling:sling for project:
null:org.apache.sling.jcr.contentloader:bundle:2.0.3-incubator-SNAPSHOT for
project null:org.apache.sling.jcr.contentloader:bundle:2.0.3-incubator-SNAPSHOT
So this patch may not work, also due to only starting looking at Sling a couple
of days ago I am unsure as to what issues I may not know about in regards to
what I have changed.
P.S. The project looks great, I am very excited by the possibilities of what
can be done with this.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.