You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Bryce Ewing (JIRA)" <ji...@apache.org> on 2008/06/19 06:20:45 UTC

[jira] Created: (SLING-545) Node with primary node type set to nt:unstructured (via json), overridden to nt:folder

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.


[jira] Updated: (SLING-545) Node with primary node type set to nt:unstructured (via json), overridden to nt:folder

Posted by "Bryce Ewing (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-545?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryce Ewing updated SLING-545:
------------------------------

    Attachment: loader.patch

> 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
>         Attachments: loader.patch
>
>
> 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.


[jira] Resolved: (SLING-545) Node with primary node type set to nt:unstructured (via json), overridden to nt:folder

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-545?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger resolved SLING-545.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: JCR Contentloader 2.0.2

Thanks for reporting and providing the patch. I applied it with two modifications in Rev. 669469.

The modifications I made:
* The processedEntries entry for the root descript must refer to the session root node, not
   to the parent node (may still be the same, but it should be explicit IMHO)
* When checking for a processedEntry of a descriptor just get the entry and check the
   value; if null have the descriptor applied.

The cause of this problem is probably the recently added "overwrite" flag, which causes the createFolder method to remove any existing node at that location regardless of whether it has been created due to a descriptor file or by previous bundle installation.

Please test this and close this issue if it works for you. Thanks.

> 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
>            Assignee: Felix Meschberger
>            Priority: Minor
>             Fix For: JCR Contentloader 2.0.2
>
>         Attachments: loader.patch
>
>
> 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.


[jira] Assigned: (SLING-545) Node with primary node type set to nt:unstructured (via json), overridden to nt:folder

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-545?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger reassigned SLING-545:
---------------------------------------

    Assignee: Felix Meschberger

> 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
>            Assignee: Felix Meschberger
>            Priority: Minor
>         Attachments: loader.patch
>
>
> 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.


[jira] Closed: (SLING-545) Node with primary node type set to nt:unstructured (via json), overridden to nt:folder

Posted by "Bryce Ewing (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-545?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryce Ewing closed SLING-545.
-----------------------------


Works correctly now, thanks.

> 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
>            Assignee: Felix Meschberger
>            Priority: Minor
>             Fix For: JCR Contentloader 2.0.2
>
>         Attachments: loader.patch
>
>
> 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.