Program: 64404
Project: 64404
Buggy source:
@Override protected Object doMainTask(TaskMonitor monitor,ObjectRepository repository){
  ALMultiParamTask multiParamTask=(ALMultiParamTask)this.multiParamTaskOption.getPreMaterializedObject();
  Option[] variedParamValueOptions=multiParamTask.variedParamValuesOption.getList();
  int numVariedParams=variedParamValueOptions.length;
  double[] variedParamValues=new double[numVariedParams];
  for (int i=0; i < numVariedParams; i++) {
    variedParamValues[i]=Double.valueOf(variedParamValueOptions[i].getValueAsCLIString());
  }
  PreviewCollection<PreviewCollection<PreviewCollectionLearningCurveWrapper>> previewCollection=new PreviewCollection<>("String_Node_Str","String_Node_Str",this.getClass(),multiParamTask.variedParamNameOption.getValueAsCLIString(),variedParamValues);
  monitor.setCurrentActivity("String_Node_Str",50.0);
  monitor.setCurrentActivity("String_Node_Str",-1.0);
  for (int i=0; i < this.subtaskThreads.size(); ++i) {
    subtaskThreads.get(i).start();
  }
  int numSubtaskThreads=subtaskThreads.size();
  boolean allThreadsCompleted=false;
  while (!allThreadsCompleted) {
    allThreadsCompleted=true;
    int oldNumEntries=previewCollection.numEntries();
    double completionSum=0;
    for (int i=0; i < numSubtaskThreads; ++i) {
      ALTaskThread currentTaskThread=subtaskThreads.get(i);
      allThreadsCompleted&=currentTaskThread.isComplete();
      if (currentTaskThread.failed() || currentTaskThread.cancelled()) {
        monitor.requestCancel();
      }
      completionSum+=currentTaskThread.getCurrentActivityFracComplete();
      @SuppressWarnings("String_Node_Str") PreviewCollection<PreviewCollectionLearningCurveWrapper> latestPreview=(PreviewCollection<PreviewCollectionLearningCurveWrapper>)currentTaskThread.getLatestResultPreview();
      if (latestPreview != null && latestPreview.numEntries() > 0) {
        previewCollection.setPreview(i,latestPreview);
      }
 else {
        break;
      }
    }
    double completionFraction=completionSum / numSubtaskThreads;
    monitor.setCurrentActivityFractionComplete(completionFraction);
    if (monitor.taskShouldAbort()) {
      return null;
    }
    if (oldNumEntries < previewCollection.numEntries()) {
      if (monitor.resultPreviewRequested() || isSubtask()) {
        monitor.setLatestResultPreview(previewCollection.copy());
      }
    }
  }
  return previewCollection;
}

Fixed version (ground truth):
@Override protected Object doMainTask(TaskMonitor monitor,ObjectRepository repository){
  ALMultiParamTask multiParamTask=(ALMultiParamTask)this.multiParamTaskOption.getPreMaterializedObject();
  Option[] variedParamValueOptions=multiParamTask.variedParamValuesOption.getList();
  int numVariedParams=variedParamValueOptions.length;
  double[] variedParamValues=new double[numVariedParams];
  for (int i=0; i < numVariedParams; i++) {
    variedParamValues[i]=Double.valueOf(variedParamValueOptions[i].getValueAsCLIString());
  }
  PreviewCollection<PreviewCollection<PreviewCollectionLearningCurveWrapper>> previewCollection=new PreviewCollection<>("String_Node_Str","String_Node_Str",this.getClass(),multiParamTask.variedParamNameOption.getValueAsCLIString(),variedParamValues);
  monitor.setCurrentActivity("String_Node_Str",50.0);
  monitor.setCurrentActivity("String_Node_Str",-1.0);
  for (int i=0; i < this.subtaskThreads.size(); ++i) {
    subtaskThreads.get(i).start();
  }
  int numSubtaskThreads=subtaskThreads.size();
  boolean allThreadsCompleted=false;
  while (!allThreadsCompleted) {
    allThreadsCompleted=true;
    int oldNumEntries=previewCollection.numEntries();
    double completionSum=0;
    for (int i=0; i < numSubtaskThreads; ++i) {
      ALTaskThread currentTaskThread=subtaskThreads.get(i);
      allThreadsCompleted&=currentTaskThread.isComplete();
      if (currentTaskThread.failed() || currentTaskThread.cancelled()) {
        monitor.requestCancel();
      }
      completionSum+=currentTaskThread.getCurrentActivityFracComplete();
      @SuppressWarnings("String_Node_Str") PreviewCollection<PreviewCollectionLearningCurveWrapper> latestPreview=(PreviewCollection<PreviewCollectionLearningCurveWrapper>)currentTaskThread.getLatestResultPreview();
      if (latestPreview != null && latestPreview.numEntries() > 0) {
        previewCollection.setPreview(i,latestPreview);
      }
 else       if (!currentTaskThread.isComplete()) {
        break;
      }
    }
    double completionFraction=completionSum / numSubtaskThreads;
    monitor.setCurrentActivityFractionComplete(completionFraction);
    if (monitor.taskShouldAbort()) {
      return null;
    }
    if (oldNumEntries < previewCollection.numEntries()) {
      if (monitor.resultPreviewRequested() || isSubtask()) {
        monitor.setLatestResultPreview(previewCollection.copy());
      }
    }
  }
  return previewCollection;
}