JCR2SPI Node.addMixin ignored and not added to ChangeLog
--------------------------------------------------------
Key: JCR-1122
URL: https://issues.apache.org/jira/browse/JCR-1122
Project: Jackrabbit
Issue Type: Bug
Components: SPI
Affects Versions: 1.4
Reporter: David Rauschenbach
The Node.addMixin(String) method does not result in any state change being
recorded. A subsequent save then becomes a noop, because there are no affected
nodes.
The addMixin method is called on an existing node that does not yet contain a
jcr:mixinTypes property, so SessionItemStateManager performs addPropertyState,
and then performs nState.markModified().
When rootNode (parent of the node used above) save() is called, getItemState()
is immediately called by save, and returns state.status = Status.EXISTING.
However there are pending changes, so save falls through and calls
getChangeLog, which returns an empty log because NodeEntryImpl.collectStates
returns nothing, because getAllChildEntries also returns nothing, not even a
propertyEntry for the new transient jcr:mixinTypes property.
Test code:
final String NODE = "testNode";
Session serverSession = login(repository, creds);
Node serverRootNode = serverSession.getRootNode();
Node serverNode = serverRootNode.addNode(NODE,
"nt:unstructured");
serverSession.save();
assertEquals(0, serverNode.getMixinNodeTypes().length);
Session clientSession = login(clientRepository, creds);
Node clientNode = clientSession.getRootNode().getNode(NODE);
clientNode.addMixin("mix:referenceable"); <== Doesn't mark
anything modified
clientSession.save(); <== Does nothing
serverNode.refresh(false);
assertEquals(1, serverNode.getMixinNodeTypes().length); <==
fails
I'm using an SPI I implemented, in conjunction with the jcr2spi and spi2jcr
bridges, coupled with a back-end Jackrabbit in-memory filesystem. So there's
always the possibility that node or property SPI calls inject errors and cause
this downstream problem.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.