NodeItem.insertInPath(): don't hide field 'name'

This commit is contained in:
Paul Campbell 2016-05-25 14:23:33 +01:00
parent 5d0de83aef
commit d0e6769126

View file

@ -321,8 +321,8 @@ public class NodeItem<T> implements Node<T> {
addChild(nodeItem); addChild(nodeItem);
return; return;
} }
String name = nodeItem.getName(); String nodeName = nodeItem.getName();
final Optional<Node<T>> childNamed = findChildByName(name); final Optional<Node<T>> childNamed = findChildByName(nodeName);
if (!childNamed.isPresent()) { // nothing with the same name exists if (!childNamed.isPresent()) { // nothing with the same name exists
addChild(nodeItem); addChild(nodeItem);
return; return;
@ -330,7 +330,7 @@ public class NodeItem<T> implements Node<T> {
// we have an existing node with the same name // we have an existing node with the same name
final Node<T> existing = childNamed.get(); final Node<T> existing = childNamed.get();
if (!existing.isEmpty()) { if (!existing.isEmpty()) {
throw new NodeException("A non-empty node named '" + name throw new NodeException("A non-empty node named '" + nodeName
+ "' already exists here"); + "' already exists here");
} else { } else {
existing.setData(nodeItem.getData()); existing.setData(nodeItem.getData());