diff --git a/dhfs-parent/kleppmanntree/src/main/java/com/usatiuk/kleppmanntree/KleppmannTree.java b/dhfs-parent/kleppmanntree/src/main/java/com/usatiuk/kleppmanntree/KleppmannTree.java index 29b3b142..a84091a8 100644 --- a/dhfs-parent/kleppmanntree/src/main/java/com/usatiuk/kleppmanntree/KleppmannTree.java +++ b/dhfs-parent/kleppmanntree/src/main/java/com/usatiuk/kleppmanntree/KleppmannTree.java @@ -344,6 +344,9 @@ public class KleppmannTree, PeerIdT ex var conflictNodeId = newParent.children().get(op.newMeta().getName()); if (conflictNodeId != null) { + if (failCreatingIfExists) + throw new AlreadyExistsException("Already exists: " + op.newMeta().getName() + ": " + conflictNodeId); + var conflictNode = _storage.getById(conflictNodeId); MetaT conflictNodeMeta = conflictNode.meta(); @@ -351,9 +354,6 @@ public class KleppmannTree, PeerIdT ex return new LogRecord<>(op, null); } - if (failCreatingIfExists) - throw new AlreadyExistsException("Already exists: " + op.newMeta().getName() + ": " + conflictNodeId); - String newConflictNodeName = conflictNodeMeta.getName() + ".conflict." + conflictNode.key(); String newOursName = op.newMeta().getName() + ".conflict." + op.childId(); return new LogRecord<>(op, List.of(