}
Iterator<Map.Entry<String,Long>> it = logsToCopy.entrySet().iterator();
boolean modified = false;
while (it.hasNext()) {
Map.Entry<String,Long> entry = it.next();
FlowNode node;
try {
node = execution.getNode(entry.getKey());
} catch (IOException x) {
LOGGER.log(Level.WARNING, null, x);
it.remove();
modified = true;
continue;
}
if (node == null) {
LOGGER.log(Level.WARNING, "no such node {0}", entry.getKey());
it.remove();
modified = true;
continue;
}
LogAction la = node.getAction(LogAction.class);
if (la != null) {
AnnotatedLargeText<? extends FlowNode> logText = la.getLogText();
try {
long old = entry.getValue();
long revised = logText.writeRawLogTo(old, listener.getLogger());
if (revised != old) {
entry.setValue(revised);
modified = true;
}
if (logText.isComplete()) {
logText.writeRawLogTo(entry.getValue(), listener.getLogger()); // defend against race condition?
assert !node.isRunning() : "LargeText.complete yet " + node + " claims to still be running";
it.remove();
modified = true;
}
} catch (IOException x) {
LOGGER.log(Level.WARNING, null, x);
it.remove();
modified = true;
}
} else if (!node.isRunning()) {
it.remove();
modified = true;
}
}
if (modified) {