You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by re...@apache.org on 2012/05/04 17:32:21 UTC

svn commit: r1334034 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappings.java

Author: reschke
Date: Fri May  4 15:32:20 2012
New Revision: 1334034

URL: http://svn.apache.org/viewvc?rev=1334034&view=rev
Log:
try to set node types on jcr:system and jcr:system/jcr:namespaces properly

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappings.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappings.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappings.java?rev=1334034&r1=1334033&r2=1334034&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappings.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappings.java Fri May  4 15:32:20 2012
@@ -198,6 +198,7 @@ public class NamespaceMappings {
         if (system == null) {
             if (create) {
                 system = tree.addChild("jcr:system");
+                system.setProperty("jcr:primaryType", this.session.getCoreValueFactory().createValue("rep:system", PropertyType.NAME));
             } else {
                 return null;
             }
@@ -205,7 +206,7 @@ public class NamespaceMappings {
         Tree namespaces = system.getChild("jcr:namespaces");
         if (namespaces == null && create) {
             namespaces = system.addChild("jcr:namespaces");
-            namespaces.setProperty("jcr:primaryType", this.session.getCoreValueFactory().createValue("rep:system", PropertyType.NAME));
+            namespaces.setProperty("jcr:primaryType", this.session.getCoreValueFactory().createValue("nt:unstructured", PropertyType.NAME));
         }
         return namespaces;
     }



Re: occasional TCK test failure

Posted by Julian Reschke <ju...@gmx.de>.
On 2012-05-05 15:28, Michael Dürig wrote:
>
>
> On 5.5.12 11:34, Julian Reschke wrote:
>> Hi there,
>>
>> occasionally I get a test failure because the TCK discovers a node that
>> lacks a primary type.
>>
>> As far as I recall, it's either /jcr:system or
>> /jcr:system/jcr:namespaces (of course right now it doesn't occur).
>>
>> With the change below I tried to make sure the type is set, but maybe
>> I'm doing something wrong?
>>
>> if (create) {
>> system = tree.addChild("jcr:system");
>> + system.setProperty("jcr:primaryType",
>> this.session.getCoreValueFactory().createValue("rep:system",
>> PropertyType.NAME));
>> } else {
>
> This looks good to me. There are two things we should do further down
 > ...

FWIW I haven't seen the failure again.

> ...

Best regards, Julian

Re: occasional TCK test failure

Posted by Michael Dürig <md...@apache.org>.

On 5.5.12 11:34, Julian Reschke wrote:
> Hi there,
>
> occasionally I get a test failure because the TCK discovers a node that
> lacks a primary type.
>
> As far as I recall, it's either /jcr:system or
> /jcr:system/jcr:namespaces (of course right now it doesn't occur).
>
> With the change below I tried to make sure the type is set, but maybe
> I'm doing something wrong?
>
> if (create) {
> system = tree.addChild("jcr:system");
> + system.setProperty("jcr:primaryType",
> this.session.getCoreValueFactory().createValue("rep:system",
> PropertyType.NAME));
> } else {

This looks good to me. There are two things we should do further down 
the line however: 1. don't set nt:unstructured but treat it as implied 
and 2. have some utility for operating on Tree instances which encodes 
the content model. 2. frees us of setting primary type and related 
things all over again and also keeps the content model encapsulated 
which make it easier to adapt later on.

Michael

>
> Help appreciated, Julian
>
>
> -------- Original Message --------
> Subject: svn commit: r1334034 -
> /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappings.java
>
> Date: Fri, 04 May 2012 15:32:21 -0000
> From: reschke@apache.org
> Reply-To: oak-commits@jackrabbit.apache.org
> To: oak-commits@jackrabbit.apache.org
>
> Author: reschke
> Date: Fri May 4 15:32:20 2012
> New Revision: 1334034
>
> URL: http://svn.apache.org/viewvc?rev=1334034&view=rev
> Log:
> try to set node types on jcr:system and jcr:system/jcr:namespaces properly
>
> Modified:
>
> jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappings.java
>
>
> Modified:
> jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappings.java
>
> URL:
> http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappings.java?rev=1334034&r1=1334033&r2=1334034&view=diff
>
> ==============================================================================
>
> ---
> jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappings.java
> (original)
> +++
> jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappings.java
> Fri May 4 15:32:20 2012
> @@ -198,6 +198,7 @@ public class NamespaceMappings {
> if (system == null) {
> if (create) {
> system = tree.addChild("jcr:system");
> + system.setProperty("jcr:primaryType",
> this.session.getCoreValueFactory().createValue("rep:system",
> PropertyType.NAME));
> } else {
> return null;
> }
> @@ -205,7 +206,7 @@ public class NamespaceMappings {
> Tree namespaces = system.getChild("jcr:namespaces");
> if (namespaces == null && create) {
> namespaces = system.addChild("jcr:namespaces");
> - namespaces.setProperty("jcr:primaryType",
> this.session.getCoreValueFactory().createValue("rep:system",
> PropertyType.NAME));
> + namespaces.setProperty("jcr:primaryType",
> this.session.getCoreValueFactory().createValue("nt:unstructured",
> PropertyType.NAME));
> }
> return namespaces;
> }
>
>
>


occasional TCK test failure

Posted by Julian Reschke <ju...@gmx.de>.
Hi there,

occasionally I get a test failure because the TCK discovers a node that 
lacks a primary type.

As far as I recall, it's either /jcr:system or 
/jcr:system/jcr:namespaces (of course right now it doesn't occur).

With the change below I tried to make sure the type is set, but maybe 
I'm doing something wrong?

              if (create) {
                  system = tree.addChild("jcr:system");
+                system.setProperty("jcr:primaryType", 
this.session.getCoreValueFactory().createValue("rep:system", 
PropertyType.NAME));
              } else {

Help appreciated, Julian


-------- Original Message --------
Subject: svn commit: r1334034 - 
/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappings.java
Date: Fri, 04 May 2012 15:32:21 -0000
From: reschke@apache.org
Reply-To: oak-commits@jackrabbit.apache.org
To: oak-commits@jackrabbit.apache.org

Author: reschke
Date: Fri May  4 15:32:20 2012
New Revision: 1334034

URL: http://svn.apache.org/viewvc?rev=1334034&view=rev
Log:
try to set node types on jcr:system and jcr:system/jcr:namespaces properly

Modified:
 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappings.java

Modified: 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappings.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappings.java?rev=1334034&r1=1334033&r2=1334034&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappings.java 
(original)
+++ 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappings.java 
Fri May  4 15:32:20 2012
@@ -198,6 +198,7 @@ public class NamespaceMappings {
          if (system == null) {
              if (create) {
                  system = tree.addChild("jcr:system");
+                system.setProperty("jcr:primaryType", 
this.session.getCoreValueFactory().createValue("rep:system", 
PropertyType.NAME));
              } else {
                  return null;
              }
@@ -205,7 +206,7 @@ public class NamespaceMappings {
          Tree namespaces = system.getChild("jcr:namespaces");
          if (namespaces == null && create) {
              namespaces = system.addChild("jcr:namespaces");
-            namespaces.setProperty("jcr:primaryType", 
this.session.getCoreValueFactory().createValue("rep:system", 
PropertyType.NAME));
+            namespaces.setProperty("jcr:primaryType", 
this.session.getCoreValueFactory().createValue("nt:unstructured", 
PropertyType.NAME));
          }
          return namespaces;
      }