JournalDiffLoader implements DiffCache.Loader { @Override public String call() { RevisionVector afterRev = node.getRootRevision(); RevisionVector beforeRev = base.getRootRevision(); stats = new Stats(node.getPath(), beforeRev, afterRev); StringSort changes = JournalEntry.newSorter(); try { Path path = node.getPath(); readTrunkChanges(path, beforeRev, afterRev, changes); readBranchChanges(path, beforeRev, changes); readBranchChanges(path, afterRev, changes); changes.sort(); DiffCache df = ns.getDiffCache(); WrappedDiffCache wrappedCache = new WrappedDiffCache(node.getPath(), df, stats); JournalEntry.applyTo(changes, wrappedCache, node.getPath(), beforeRev, afterRev); return wrappedCache.changes; } catch (IOException e) { throw DocumentStoreException.convert(e); } finally { Utils.closeIfCloseable(changes); logStats(); } } JournalDiffLoader(@NotNull AbstractDocumentNodeState base,
                      @NotNull AbstractDocumentNodeState node,
                      @NotNull DocumentNodeStore ns); @Override String call();  }
@Test public void emptyBranchCommit() throws Exception { DocumentNodeStore ns = builderProvider.newBuilder() .clock(clock).setAsyncDelay(0).disableBranches().getNodeStore(); DocumentStore store = ns.getDocumentStore(); DocumentNodeState before = ns.getRoot(); String id = Utils.getIdFromPath("/node-0"); NodeBuilder builder = ns.getRoot().builder(); int i = 0; while (store.find(Collection.NODES, id) == null) { NodeBuilder child = builder.child("node-" + i++); for (int j = 0; j < 20; j++) { child.setProperty("p-" + j, "value"); } } merge(ns, builder); DocumentNodeState after = ns.getRoot(); new JournalDiffLoader(before, after, ns).call(); }