Hi, On Thu, 2016-09-01 at 09:47 +0200, Michael Dürig wrote: > Hi, > > All methods of the NodeStore API that take a NodeBuilder argument > require that NodeBuilder to initially have been acquired from that > same > store. Otherwise the method will throw an IllegalArgumentException. > E.g. > the Javadoc of NodeStore.merge states: "throws > IllegalArgumentException > if the builder is not acquired from a root state of this store".
Yes, agreed. But in this case the InitialContent class receives a NodeBuilder in the initialize method, and then passes it to a MemoryNodeStore NodeState base = ModifiedNodeState.squeeze(builder.getNodeState()); NodeStore store = new MemoryNodeStore(base); NodeTypeRegistry.registerBuiltIn(RootFactory.createSystemRoot( store, new EditorHook(new CompositeEditorProvider( new NamespaceEditorProvider(), new TypeEditorProvider())), null, null, null, null)); Since the NodeStore is based on a NodeBuilder's current state and that NodeBuilder is not a MemoryNodeBuilder the check that you mentioned is triggered. The question is - is it correct to use a MemoryNodeStore in this way here? Robert > > Michael > > > On 1.9.16 9:36 , Robert Munteanu wrote: > > > > Hi, > > > > I'm working on implementing a custom node store which multiplexes > > other > > node stores. > > > > Adding it as a fixture in oak-it results in a test failure in > > > > ReadWriteNamespaceRegistryTest.testMappings [1] > > > > The reason is > > that > > org.apache.jackrabbit.oak.plugins.nodetype.write.InitialContent > > class wraps the passed nodeStore into a MemoryNodeStore, and that > > memory node store later on receives a builder which is not > > MemoryNodeBuilder [2] → IllegalArgumentException. > > > > I'm not familiar enough with that class to propose a fix, but > > effectively it forces all builders to be MemoryNodeBuilders, which > > is > > too restrictive IMO. > > > > Is this a bug to file or something that I need to live with when > > implementing a new NodeStore? > > > > Thanks, > > > > Robert > > > > > > [1]: https://github.com/apache/jackrabbit-oak/blob/64f48874ac4aab6e > > 0ffb > > 085e07642ffa44d8c7ca/oak- > > it/src/test/java/org/apache/jackrabbit/oak/plugins/name/ReadWriteNa > > mesp > > aceRegistryTest.java#L46 > > [2]: https://github.com/apache/jackrabbit-oak/blob/64f48874ac4aab6e > > 0ffb > > 085e07642ffa44d8c7ca/oak- > > core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write > > /Ini > > tialContent.java#L119 > >
