Source:
<code>private boolean addTrace(@Nullable IProgressMonitor monitor) { boolean fetchTreeIsComplete = true; ITmfTrace trace = getTrace(); String traceName = Objects.requireNonNull(trace.getName()); EntryModelBuilder entry = fEntryBuilder.get(-1L, traceName); TraceEntryModel.Builder traceEntry; if (entry != null && entry instanceof TraceEntryModel.Builder) { traceEntry = (TraceEntryModel.Builder) entry; } else { long newId = ENTRY_ID.getAndIncrement(); traceEntry = new TraceEntryModel.Builder(newId, -1, Objects.requireNonNull(trace.getName()), trace.getStartTime().toNanos(), trace); fEntryBuilder.put(-1L, traceName, traceEntry); } long rootId = traceEntry.getId(); for (Entry<ITmfAnalysisModuleWithStateSystems, Boolean> moduleWithStatus : fModulesToStatus.entrySet()) { if (monitor != null) { if (monitor.isCanceled()) { return false; } } ITmfAnalysisModuleWithStateSystems module = Objects.requireNonNull(moduleWithStatus.getKey()); Boolean analysisIsDone = Objects.requireNonNull(moduleWithStatus.getValue()); if (!analysisIsDone || fStartedAnalysis.contains(module)) { fetchTreeIsComplete &= addModules(monitor, module, rootId, trace.getStartTime().toNanos()); <START> if (fModulesToStatus.get(module) != null && fStartedAnalysis.contains(module)) { if (Objects.requireNonNull(fModulesToStatus.get(module))) { fStartedAnalysis.remove(module); } } <END> } } long traceEnd = traceEntry.getStartTime(); for (ModuleEntryModel moduleEntryModel : moduleEntryModelList) { if (monitor != null) { if (monitor.isCanceled()) { return false; } } traceEnd = Long.max(traceEnd, moduleEntryModel.getEndTime()); } traceEntry.setEndTime(traceEnd); fEntryBuilder.put(-1L, traceName, traceEntry); return fetchTreeIsComplete; }</code><technical_language>in a for loop of fModulesToStatus, module is in fModulesToStatus. try remove module fStartedAnalysis, if is there, do (unless is kind of list throws exception, soon enough ;-)</technical_language>

Target:
private boolean addTrace(@Nullable IProgressMonitor monitor) { boolean fetchTreeIsComplete = true; ITmfTrace trace = getTrace(); String traceName = Objects.requireNonNull(trace.getName()); EntryModelBuilder entry = fEntryBuilder.get(-1L, traceName); TraceEntryModel.Builder traceEntry; if (entry != null && entry instanceof TraceEntryModel.Builder) { traceEntry = (TraceEntryModel.Builder) entry; } else { long newId = ENTRY_ID.getAndIncrement(); traceEntry = new TraceEntryModel.Builder(newId, -1, Objects.requireNonNull(trace.getName()), trace.getStartTime().toNanos(), trace); fEntryBuilder.put(-1L, traceName, traceEntry); } long rootId = traceEntry.getId(); for (Entry<ITmfAnalysisModuleWithStateSystems, Boolean> moduleWithStatus : fModulesToStatus.entrySet()) { if (monitor != null) { if (monitor.isCanceled()) { return false; } } ITmfAnalysisModuleWithStateSystems module = Objects.requireNonNull(moduleWithStatus.getKey()); Boolean analysisIsDone = Objects.requireNonNull(moduleWithStatus.getValue()); if (!analysisIsDone || fStartedAnalysis.contains(module)) { fetchTreeIsComplete &= addModule(monitor, module, rootId, trace.getStartTime().toNanos()); fStartedAnalysis.remove(module); } } long traceEnd = traceEntry.getStartTime(); for (ModuleEntryModel moduleEntryModel : moduleEntryModelList) { if (monitor != null) { if (monitor.isCanceled()) { return false; } } traceEnd = Long.max(traceEnd, moduleEntryModel.getEndTime()); } traceEntry.setEndTime(traceEnd); fEntryBuilder.put(-1L, traceName, traceEntry); return fetchTreeIsComplete; }