[ 
https://issues.apache.org/jira/browse/OAK-182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13414964#comment-13414964
 ] 

Thomas Mueller edited comment on OAK-182 at 7/16/12 9:52 AM:
-------------------------------------------------------------

When enabling the IndexWrapper in the ContentRepositoryImpl default 
constructor, the org.apache.jackrabbit.oak.jcr.RepositoryTest.observation test 
fails with the exception stack trace below. I have a patch that fixed the 
issue, but I'm not familiar with the code and wonder if that is really the best 
way to fix it:

{{
Index: src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractNodeState.java
===================================================================
--- src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractNodeState.java    
(revision 1361947)
+++ src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractNodeState.java    
(working copy)
@@ -97,6 +97,10 @@
         Set<String> baseChildNodes = new HashSet<String>();
         for (ChildNodeEntry beforeCNE : base.getChildNodeEntries()) {
             String name = beforeCNE.getName();
+            if (name.startsWith(":")) {
+                // OAK-182: ignore invisible internal content
+                continue;
+            }
             NodeState beforeChild = beforeCNE.getNodeState();
             NodeState afterChild = getChildNode(name);
             if (afterChild == null) {
@@ -110,6 +114,10 @@
         }
         for (ChildNodeEntry afterChild : getChildNodeEntries()) {
             String name = afterChild.getName();
+            if (name.startsWith(":")) {
+                // OAK-182: ignore invisible internal content
+                continue;
+            }
             if (!baseChildNodes.contains(name)) {
                 diff.childNodeAdded(name, afterChild.getNodeState());
             }
}}

Stack trace without the patch:

{{
Exception in thread "Observation" java.lang.IllegalArgumentException: 
'/jcr:system/indexes/:data' is not a valid path. Prefix must not be empty
        at 
org.apache.jackrabbit.oak.namepath.NamePathMapperImpl$1.error(NamePathMapperImpl.java:108)
        at 
org.apache.jackrabbit.oak.namepath.JcrPathParser.parse(JcrPathParser.java:151)
        at 
org.apache.jackrabbit.oak.namepath.NamePathMapperImpl.getJcrPath(NamePathMapperImpl.java:122)
        at 
org.apache.jackrabbit.oak.jcr.observation.ChangeProcessor$EventGeneratingNodeStateDiff.jcrPath(ChangeProcessor.java:104)
        at 
org.apache.jackrabbit.oak.jcr.observation.ChangeProcessor$EventGeneratingNodeStateDiff.propertyChanged(ChangeProcessor.java:117)
        at 
org.apache.jackrabbit.oak.spi.state.AbstractNodeState.compareAgainstBaseState(AbstractNodeState.java:87)
        at 
org.apache.jackrabbit.oak.kernel.KernelNodeState.compareAgainstBaseState(KernelNodeState.java:214)
        at 
org.apache.jackrabbit.oak.jcr.observation.ChangeProcessor$EventGeneratingNodeStateDiff.childNodeChanged(ChangeProcessor.java:155)
        at 
org.apache.jackrabbit.oak.spi.state.AbstractNodeState.compareAgainstBaseState(AbstractNodeState.java:107)
        at 
org.apache.jackrabbit.oak.kernel.KernelNodeState.compareAgainstBaseState(KernelNodeState.java:214)
        at 
org.apache.jackrabbit.oak.jcr.observation.ChangeProcessor$EventGeneratingNodeStateDiff.childNodeChanged(ChangeProcessor.java:155)
        at 
org.apache.jackrabbit.oak.spi.state.AbstractNodeState.compareAgainstBaseState(AbstractNodeState.java:107)
        at 
org.apache.jackrabbit.oak.kernel.KernelNodeState.compareAgainstBaseState(KernelNodeState.java:214)
        at 
org.apache.jackrabbit.oak.jcr.observation.ChangeProcessor$EventGeneratingNodeStateDiff.childNodeChanged(ChangeProcessor.java:155)
        at 
org.apache.jackrabbit.oak.spi.state.AbstractNodeState.compareAgainstBaseState(AbstractNodeState.java:107)
        at 
org.apache.jackrabbit.oak.kernel.KernelNodeState.compareAgainstBaseState(KernelNodeState.java:214)
        at 
org.apache.jackrabbit.oak.core.RootImpl$1.getChanges(RootImpl.java:187)
        at 
org.apache.jackrabbit.oak.jcr.observation.ChangeProcessor.run(ChangeProcessor.java:70)
        at java.util.TimerThread.mainLoop(Timer.java:512)
        at java.util.TimerThread.run(Timer.java:462)
}}

                
      was (Author: tmueller):
    When enabling the IndexWrapper in the ContentRepositoryImpl default 
constructor, the org.apache.jackrabbit.oak.jcr.RepositoryTest.observation test 
fails with the exception stack trace below. I have a patch that fixed the 
issue, but I'm not familiar with the code and wonder if that is really the best 
way to fix it:

Index: src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractNodeState.java
===================================================================
--- src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractNodeState.java    
(revision 1361947)
+++ src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractNodeState.java    
(working copy)
@@ -97,6 +97,10 @@
         Set<String> baseChildNodes = new HashSet<String>();
         for (ChildNodeEntry beforeCNE : base.getChildNodeEntries()) {
             String name = beforeCNE.getName();
+            if (name.startsWith(":")) {
+                // OAK-182: ignore invisible internal content
+                continue;
+            }
             NodeState beforeChild = beforeCNE.getNodeState();
             NodeState afterChild = getChildNode(name);
             if (afterChild == null) {
@@ -110,6 +114,10 @@
         }
         for (ChildNodeEntry afterChild : getChildNodeEntries()) {
             String name = afterChild.getName();
+            if (name.startsWith(":")) {
+                // OAK-182: ignore invisible internal content
+                continue;
+            }
             if (!baseChildNodes.contains(name)) {
                 diff.childNodeAdded(name, afterChild.getNodeState());
             }


Stack trace without the patch:

Exception in thread "Observation" java.lang.IllegalArgumentException: 
'/jcr:system/indexes/:data' is not a valid path. Prefix must not be empty
        at 
org.apache.jackrabbit.oak.namepath.NamePathMapperImpl$1.error(NamePathMapperImpl.java:108)
        at 
org.apache.jackrabbit.oak.namepath.JcrPathParser.parse(JcrPathParser.java:151)
        at 
org.apache.jackrabbit.oak.namepath.NamePathMapperImpl.getJcrPath(NamePathMapperImpl.java:122)
        at 
org.apache.jackrabbit.oak.jcr.observation.ChangeProcessor$EventGeneratingNodeStateDiff.jcrPath(ChangeProcessor.java:104)
        at 
org.apache.jackrabbit.oak.jcr.observation.ChangeProcessor$EventGeneratingNodeStateDiff.propertyChanged(ChangeProcessor.java:117)
        at 
org.apache.jackrabbit.oak.spi.state.AbstractNodeState.compareAgainstBaseState(AbstractNodeState.java:87)
        at 
org.apache.jackrabbit.oak.kernel.KernelNodeState.compareAgainstBaseState(KernelNodeState.java:214)
        at 
org.apache.jackrabbit.oak.jcr.observation.ChangeProcessor$EventGeneratingNodeStateDiff.childNodeChanged(ChangeProcessor.java:155)
        at 
org.apache.jackrabbit.oak.spi.state.AbstractNodeState.compareAgainstBaseState(AbstractNodeState.java:107)
        at 
org.apache.jackrabbit.oak.kernel.KernelNodeState.compareAgainstBaseState(KernelNodeState.java:214)
        at 
org.apache.jackrabbit.oak.jcr.observation.ChangeProcessor$EventGeneratingNodeStateDiff.childNodeChanged(ChangeProcessor.java:155)
        at 
org.apache.jackrabbit.oak.spi.state.AbstractNodeState.compareAgainstBaseState(AbstractNodeState.java:107)
        at 
org.apache.jackrabbit.oak.kernel.KernelNodeState.compareAgainstBaseState(KernelNodeState.java:214)
        at 
org.apache.jackrabbit.oak.jcr.observation.ChangeProcessor$EventGeneratingNodeStateDiff.childNodeChanged(ChangeProcessor.java:155)
        at 
org.apache.jackrabbit.oak.spi.state.AbstractNodeState.compareAgainstBaseState(AbstractNodeState.java:107)
        at 
org.apache.jackrabbit.oak.kernel.KernelNodeState.compareAgainstBaseState(KernelNodeState.java:214)
        at 
org.apache.jackrabbit.oak.core.RootImpl$1.getChanges(RootImpl.java:187)
        at 
org.apache.jackrabbit.oak.jcr.observation.ChangeProcessor.run(ChangeProcessor.java:70)
        at java.util.TimerThread.mainLoop(Timer.java:512)
        at java.util.TimerThread.run(Timer.java:462)

                  
> Support for "invisible" internal content
> ----------------------------------------
>
>                 Key: OAK-182
>                 URL: https://issues.apache.org/jira/browse/OAK-182
>             Project: Jackrabbit Oak
>          Issue Type: New Feature
>          Components: core, jcr
>            Reporter: Jukka Zitting
>
> As discussed on the mailing list 
> (http://markmail.org/message/kzt7csiz2bd5n3ww), it would be good to have a 
> naming pattern line "{{:name}}" for internal content that we don't want to 
> directly expose to JCR clients.
> JCR-related functionality like the namespace and node type validators and the 
> observation dispatcher (see also OAK-181) should know to ignore such content 
> and the JCR binding in oak-jcr should automatically filter out such internal 
> content. Such internal content should probably also not be indexed for search.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to