Program: 108183
Project: 108183
Buggy source:
@Override protected void doUpdate(final AnalysisContextRisk context){
  if (!this.isEnabled()) {
    if (manager != null) {
      manager.stop();
    }
    this.setStatusEmpty();
    return;
  }
  Analysis analysis=new Analysis(){
    RiskEstimateBuilderInterruptible builder=getBuilder(context);
    private boolean stopped=false;
    private double[] dataPitman;
    private double[] dataZayatz;
    private double[] dataSNB;
    private double[] dataDankar;
    private int idx;
    @Override public int getProgress(){
      return (int)Math.round(idx * 100d + (double)builder.getProgress()) / POINTS.length;
    }
    @Override public void onError(){
      setStatusEmpty();
    }
    @Override public void onFinish(){
      if (stopped || !isEnabled()) {
        return;
      }
      resetChart();
      ISeriesSet seriesSet=chart.getSeriesSet();
      if (showAllModels) {
        createSeries(seriesSet,dataPitman,"String_Node_Str",PlotSymbolType.CIRCLE,GUIHelper.COLOR_BLACK);
        createSeries(seriesSet,dataZayatz,"String_Node_Str",PlotSymbolType.CROSS,GUIHelper.COLOR_BLUE);
        createSeries(seriesSet,dataSNB,"String_Node_Str",PlotSymbolType.DIAMOND,GUIHelper.COLOR_RED);
        createSeries(seriesSet,dataDankar,"String_Node_Str",PlotSymbolType.SQUARE,GUIHelper.COLOR_DARK_GRAY);
        chart.getLegend().setVisible(true);
      }
 else {
        createSeries(seriesSet,dataDankar,"String_Node_Str",PlotSymbolType.SQUARE,GUIHelper.COLOR_BLACK);
        chart.getLegend().setVisible(false);
      }
      IAxisSet axisSet=chart.getAxisSet();
      IAxis yAxis=axisSet.getYAxis(0);
      yAxis.setRange(new Range(0d,1d));
      IAxis xAxis=axisSet.getXAxis(0);
      xAxis.setRange(new Range(0d,LABELS.length));
      xAxis.setCategorySeries(LABELS);
      chart.updateLayout();
      chart.update();
      updateCategories();
      chart.layout();
      chart.setRedraw(true);
      chart.redraw();
      setStatusDone();
    }
    @Override public void onInterrupt(){
      if (!isEnabled() || !isValid()) {
        setStatusEmpty();
      }
 else {
        setStatusWorking();
      }
    }
    @Override public void run() throws InterruptedException {
      long time=System.currentTimeMillis();
      dataDankar=new double[POINTS.length];
      if (showAllModels) {
        dataPitman=new double[POINTS.length];
        dataZayatz=new double[POINTS.length];
        dataSNB=new double[POINTS.length];
      }
      for (idx=0; idx < POINTS.length; idx++) {
        if (stopped) {
          throw new InterruptedException();
        }
        builder=getBuilder(context,ARXPopulationModel.create(POINTS[idx]),builder.getEquivalenceClassModel());
        if (idx == 0 && builder.getSampleBasedUniquenessRisk().getFractionOfUniqueTuples() == 0.0d) {
          Arrays.fill(dataDankar,0.0d);
          if (showAllModels) {
            Arrays.fill(dataPitman,0.0d);
            Arrays.fill(dataZayatz,0.0d);
            Arrays.fill(dataSNB,0.0d);
          }
          break;
        }
        RiskModelPopulationBasedUniquenessRisk populationBasedModel=builder.getPopulationBasedUniquenessRisk();
        dataDankar[idx]=populationBasedModel.getFractionOfUniqueTuplesDankar();
        if (showAllModels) {
          dataPitman[idx]=populationBasedModel.getFractionOfUniqueTuplesPitman();
          dataZayatz[idx]=populationBasedModel.getFractionOfUniqueTuplesZayatz();
          dataSNB[idx]=populationBasedModel.getFractionOfUniqueTuplesSNB();
        }
      }
      while (System.currentTimeMillis() - time < MINIMAL_WORKING_TIME && !stopped) {
        Thread.sleep(10);
      }
    }
    @Override public void stop(){
      builder.interrupt();
      this.stopped=true;
    }
  }
;
  this.manager.start(analysis);
}

Fixed version (ground truth):
@Override protected void doUpdate(final AnalysisContextRisk context){
  final RiskEstimateBuilderInterruptible baseBuilder=getBuilder(context);
  if (!this.isEnabled() || baseBuilder == null) {
    if (manager != null) {
      manager.stop();
    }
    this.setStatusEmpty();
    return;
  }
  Analysis analysis=new Analysis(){
    private RiskEstimateBuilderInterruptible builder=baseBuilder;
    private boolean stopped=false;
    private double[] dataPitman;
    private double[] dataZayatz;
    private double[] dataSNB;
    private double[] dataDankar;
    private int idx;
    @Override public int getProgress(){
      return (int)Math.round(idx * 100d + (double)baseBuilder.getProgress()) / POINTS.length;
    }
    @Override public void onError(){
      setStatusEmpty();
    }
    @Override public void onFinish(){
      if (stopped || !isEnabled()) {
        return;
      }
      resetChart();
      ISeriesSet seriesSet=chart.getSeriesSet();
      if (showAllModels) {
        createSeries(seriesSet,dataPitman,"String_Node_Str",PlotSymbolType.CIRCLE,GUIHelper.COLOR_BLACK);
        createSeries(seriesSet,dataZayatz,"String_Node_Str",PlotSymbolType.CROSS,GUIHelper.COLOR_BLUE);
        createSeries(seriesSet,dataSNB,"String_Node_Str",PlotSymbolType.DIAMOND,GUIHelper.COLOR_RED);
        createSeries(seriesSet,dataDankar,"String_Node_Str",PlotSymbolType.SQUARE,GUIHelper.COLOR_DARK_GRAY);
        chart.getLegend().setVisible(true);
      }
 else {
        createSeries(seriesSet,dataDankar,"String_Node_Str",PlotSymbolType.SQUARE,GUIHelper.COLOR_BLACK);
        chart.getLegend().setVisible(false);
      }
      IAxisSet axisSet=chart.getAxisSet();
      IAxis yAxis=axisSet.getYAxis(0);
      yAxis.setRange(new Range(0d,1d));
      IAxis xAxis=axisSet.getXAxis(0);
      xAxis.setRange(new Range(0d,LABELS.length));
      xAxis.setCategorySeries(LABELS);
      chart.updateLayout();
      chart.update();
      updateCategories();
      chart.layout();
      chart.setRedraw(true);
      chart.redraw();
      setStatusDone();
    }
    @Override public void onInterrupt(){
      if (!isEnabled() || !isValid()) {
        setStatusEmpty();
      }
 else {
        setStatusWorking();
      }
    }
    @Override public void run() throws InterruptedException {
      long time=System.currentTimeMillis();
      dataDankar=new double[POINTS.length];
      if (showAllModels) {
        dataPitman=new double[POINTS.length];
        dataZayatz=new double[POINTS.length];
        dataSNB=new double[POINTS.length];
      }
      for (idx=0; idx < POINTS.length; idx++) {
        if (stopped) {
          throw new InterruptedException();
        }
        builder=getBuilder(context,ARXPopulationModel.create(POINTS[idx]),builder.getEquivalenceClassModel());
        if (idx == 0 && builder.getSampleBasedUniquenessRisk().getFractionOfUniqueTuples() == 0.0d) {
          Arrays.fill(dataDankar,0.0d);
          if (showAllModels) {
            Arrays.fill(dataPitman,0.0d);
            Arrays.fill(dataZayatz,0.0d);
            Arrays.fill(dataSNB,0.0d);
          }
          break;
        }
        RiskModelPopulationBasedUniquenessRisk populationBasedModel=builder.getPopulationBasedUniquenessRisk();
        dataDankar[idx]=populationBasedModel.getFractionOfUniqueTuplesDankar();
        if (showAllModels) {
          dataPitman[idx]=populationBasedModel.getFractionOfUniqueTuplesPitman();
          dataZayatz[idx]=populationBasedModel.getFractionOfUniqueTuplesZayatz();
          dataSNB[idx]=populationBasedModel.getFractionOfUniqueTuplesSNB();
        }
      }
      while (System.currentTimeMillis() - time < MINIMAL_WORKING_TIME && !stopped) {
        Thread.sleep(10);
      }
    }
    @Override public void stop(){
      if (baseBuilder != null)       baseBuilder.interrupt();
      this.stopped=true;
    }
  }
;
  this.manager.start(analysis);
}