Program: 108237
Project: 108237
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 (stopped || !isEnabled()) {
        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=context.handle.getRiskEstimator(ARXPopulationModel.create(POINTS[idx]),builder.getEquivalenceClassModel()).getInterruptibleInstance();
        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;
        }
        dataDankar[idx]=builder.getPopulationBasedUniquenessRisk().getFractionOfUniqueTuplesDankar();
        if (showAllModels) {
          dataPitman[idx]=builder.getPopulationBasedUniquenessRisk().getFractionOfUniqueTuplesPitman();
          dataZayatz[idx]=builder.getPopulationBasedUniquenessRisk().getFractionOfUniqueTuplesZayatz();
          dataSNB[idx]=builder.getPopulationBasedUniquenessRisk().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){
  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()) {
        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=context.handle.getRiskEstimator(ARXPopulationModel.create(POINTS[idx]),builder.getEquivalenceClassModel()).getInterruptibleInstance();
        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;
        }
        dataDankar[idx]=builder.getPopulationBasedUniquenessRisk().getFractionOfUniqueTuplesDankar();
        if (showAllModels) {
          dataPitman[idx]=builder.getPopulationBasedUniquenessRisk().getFractionOfUniqueTuplesPitman();
          dataZayatz[idx]=builder.getPopulationBasedUniquenessRisk().getFractionOfUniqueTuplesZayatz();
          dataSNB[idx]=builder.getPopulationBasedUniquenessRisk().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);
}