diff --git a/src/main/java/net/kemitix/node/NodeItem.java b/src/main/java/net/kemitix/node/NodeItem.java index 4dacfd1..357d040 100644 --- a/src/main/java/net/kemitix/node/NodeItem.java +++ b/src/main/java/net/kemitix/node/NodeItem.java @@ -321,8 +321,8 @@ public class NodeItem implements Node { addChild(nodeItem); return; } - String name = nodeItem.getName(); - final Optional> childNamed = findChildByName(name); + String nodeName = nodeItem.getName(); + final Optional> childNamed = findChildByName(nodeName); if (!childNamed.isPresent()) { // nothing with the same name exists addChild(nodeItem); return; @@ -330,7 +330,7 @@ public class NodeItem implements Node { // we have an existing node with the same name final Node existing = childNamed.get(); if (!existing.isEmpty()) { - throw new NodeException("A non-empty node named '" + name + throw new NodeException("A non-empty node named '" + nodeName + "' already exists here"); } else { existing.setData(nodeItem.getData());