Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/NodeTypeTemplateImpl.java =================================================================== --- oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/NodeTypeTemplateImpl.java (revision 1801467) +++ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/NodeTypeTemplateImpl.java (working copy) @@ -25,6 +25,7 @@ import static org.apache.jackrabbit.JcrConstants.JCR_PRIMARYTYPE; import static org.apache.jackrabbit.JcrConstants.JCR_PROPERTYDEFINITION; import static org.apache.jackrabbit.JcrConstants.JCR_SUPERTYPES; +import static org.apache.jackrabbit.JcrConstants.NT_BASE; import static org.apache.jackrabbit.JcrConstants.NT_CHILDNODEDEFINITION; import static org.apache.jackrabbit.JcrConstants.NT_NODETYPE; import static org.apache.jackrabbit.JcrConstants.NT_PROPERTYDEFINITION; @@ -146,12 +147,20 @@ type.setProperty(JCR_NODETYPENAME, oakName, Type.NAME); - if (superTypeOakNames.length > 0) { + if (oakName.equals(NT_BASE)) { + // nt:base is the only node type without supertypes + // -> JCR 2.0 specification 3.7.10.1 + type.removeProperty(JCR_SUPERTYPES); + } else if (superTypeOakNames.length > 0) { type.setProperty( JCR_SUPERTYPES, Arrays.asList(superTypeOakNames), Type.NAMES); - } else { - type.removeProperty(JCR_SUPERTYPES); + } else if (!isMixin()) { + // primary node types must at least be a subtype of nt:base + // -> JCR 2.0 specification 3.7.6 + type.setProperty( + JCR_SUPERTYPES, + Lists.newArrayList(NT_BASE), Type.NAMES); } type.setProperty(JCR_IS_ABSTRACT, isAbstract); Index: oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/nodetype/write/NodeTypeRegistryTest.java =================================================================== --- oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/nodetype/write/NodeTypeRegistryTest.java (revision 1801476) +++ oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/nodetype/write/NodeTypeRegistryTest.java (working copy) @@ -75,7 +75,6 @@ import org.apache.jackrabbit.oak.plugins.tree.TreeUtil; import org.junit.After; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import static org.junit.Assert.assertFalse; @@ -172,7 +171,6 @@ } - @Ignore("OAK-6440") @Test public void registerNodeType() throws Exception { registerNodeType(root, "oak6440-1.cnd");