Rename a bunch of TaskTree addNode() methods
The naming of many of the TaskTree methods are very similar for some
things that are very different. Clarify this a bit better in the method
organization and naming.
Change-Id: Iedffc6447bdea2a0879cc8ce0f36489f47b470c6
diff --git a/src/main/java/com/googlesource/gerrit/plugins/task/TaskTree.java b/src/main/java/com/googlesource/gerrit/plugins/task/TaskTree.java
index ae76aae..0b54745 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/task/TaskTree.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/task/TaskTree.java
@@ -105,7 +105,7 @@
protected List<Node> nodes;
protected Set<String> names = new HashSet<>();
- protected void addSubDefinitions() throws ConfigInvalidException, IOException, OrmException {
+ protected void addSubNodes() throws ConfigInvalidException, IOException, OrmException {
addSubDefinitions(taskFactory.getRootConfig().getRootTasks());
}
@@ -132,13 +132,17 @@
} catch (Exception e) {
}
}
+ addInvalidNode();
+ }
+
+ protected void addInvalidNode() {
nodes.add(null); // null node indicates invalid
}
protected List<Node> getSubNodes() throws ConfigInvalidException, IOException, OrmException {
if (nodes == null) {
nodes = new ArrayList<>();
- addSubDefinitions();
+ addSubNodes();
}
return nodes;
}
@@ -169,7 +173,7 @@
}
@Override
- protected void addSubDefinitions() throws OrmException {
+ protected void addSubNodes() throws OrmException {
addSubTaskDefinitions();
addSubTasksFactoryDefinitions();
addSubFileDefinitions();
@@ -184,7 +188,7 @@
addSubDefinition(def.get());
}
} catch (ConfigInvalidException e) {
- addSubDefinition(null);
+ addInvalidNode();
}
}
}
@@ -194,7 +198,7 @@
try {
addSubDefinitions(getTaskDefinitions(task.config.getBranch(), file));
} catch (ConfigInvalidException | IOException e) {
- addSubDefinition(null);
+ addInvalidNode();
}
}
}
@@ -204,12 +208,12 @@
try {
External ext = task.config.getExternal(external);
if (ext == null) {
- addSubDefinition(null);
+ addInvalidNode();
} else {
addSubDefinitions(getTaskDefinitions(ext));
}
} catch (ConfigInvalidException | IOException e) {
- addSubDefinition(null);
+ addInvalidNode();
}
}
}
@@ -231,7 +235,7 @@
}
}
}
- addSubDefinition(null);
+ addInvalidNode();
}
}
@@ -268,7 +272,7 @@
log.atSevere().withCause(e).log("ERROR: running changes query: " + namesFactory.changes);
} catch (QueryParseException e) {
}
- addSubDefinition(null);
+ addInvalidNode();
}
protected List<Task> getTaskDefinitions(External external)