Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/JournalEntry.java =================================================================== --- oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/JournalEntry.java (revision 1783729) +++ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/JournalEntry.java (working copy) @@ -69,7 +69,7 @@ private static final String CHANGE_SET = "_cs"; - private static final String BRANCH_COMMITS = "_bc"; + static final String BRANCH_COMMITS = "_bc"; public static final String MODIFIED = "_modified"; @@ -393,6 +393,9 @@ } void branchCommit(@Nonnull Iterable revisions) { + if (!revisions.iterator().hasNext()) { + return; + } String branchCommits = (String) get(BRANCH_COMMITS); if (branchCommits == null) { branchCommits = ""; @@ -469,7 +472,9 @@ String bc = (String) get(BRANCH_COMMITS); if (bc != null) { for (String id : bc.split(",")) { - ids.add(id); + if (id.length() != 0) { + ids.add(id); + } } } return new Iterable() { Index: oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/JournalDiffLoaderTest.java =================================================================== --- oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/JournalDiffLoaderTest.java (revision 1783731) +++ oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/JournalDiffLoaderTest.java (working copy) @@ -38,7 +38,6 @@ import org.apache.jackrabbit.oak.stats.Clock; import org.junit.After; import org.junit.Before; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; @@ -327,7 +326,6 @@ journalQueryCounter.get() > 0); } - @Ignore("OAK-5651") @Test public void emptyBranchCommit() throws Exception { DocumentNodeStore ns = builderProvider.newBuilder() Index: oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/JournalEntryTest.java =================================================================== --- oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/JournalEntryTest.java (revision 1783733) +++ oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/JournalEntryTest.java (working copy) @@ -32,7 +32,6 @@ import org.apache.jackrabbit.oak.commons.json.JsopTokenizer; import org.apache.jackrabbit.oak.commons.sort.StringSort; import org.apache.jackrabbit.oak.plugins.document.memory.MemoryDocumentStore; -import org.junit.Ignore; import org.junit.Test; import static org.apache.jackrabbit.oak.plugins.document.Collection.JOURNAL; @@ -357,7 +356,6 @@ assertTrue("Incorrect hasChanges", entry.hasChanges()); } - @Ignore("OAK-5651") @Test public void emptyBranchCommit() { DocumentStore store = new MemoryDocumentStore(); @@ -365,6 +363,7 @@ entry.branchCommit(Collections.emptyList()); assertFalse(entry.getBranchCommits().iterator().hasNext()); + assertNull(entry.get(JournalEntry.BRANCH_COMMITS)); } private static void addRandomPaths(java.util.Collection paths) throws IOException {