Program: 133508
Project: 133508
Buggy source:
/** 
 * @param plotProvider
 * @param time
 */
private void showXYGraph(PlotProvider plotProvider,double time,boolean resetTraces){
  if (this.xyGraph == null) {
    xyGraph=new XYGraph();
    graphToolbar=new ToolbarArmedXYGraph(xyGraph);
    lws.setContents(graphToolbar);
    existingTraces.clear();
    xyGraph.setTitle(plotProvider.getPlotTitle());
    XYZPlotStyle plotStyle=plotProvider.getPlotStyle();
    if (plotStyle != null) {
      xyGraph.setTransparent((boolean)plotStyle.getProperty(XYZPlotStyle.IS_TRANSPARENT));
      xyGraph.setBackgroundColor((Color)plotStyle.getProperty(XYZPlotStyle.PLOT_COLOR));
      xyGraph.setShowLegend((boolean)plotStyle.getProperty(XYZPlotStyle.SHOW_LEGEND));
      xyGraph.getPlotArea().setShowBorder((boolean)plotStyle.getProperty(XYZPlotStyle.SHOW_PLOT_BORDER));
    }
    XYZAxisStyle xStyle=plotProvider.getXAxisStyle();
    XYZAxisStyle yStyle=plotProvider.getYAxisStyle();
    configureAxis(xyGraph.primaryXAxis,xStyle);
    configureAxis(xyGraph.primaryYAxis,yStyle);
  }
  lws.setContents(graphToolbar);
  ArrayList<ISeries> seriesToPlot=plotProvider.getSeriesAtTime(time);
  if (seriesToPlot == null) {
    seriesToPlot=new ArrayList<ISeries>();
  }
  double[] xValues=getDoubleValue(independentSeries);
  double[] xPlusError=new double[xValues.length];
  double[] xMinusError=new double[xValues.length];
  if (seriesMap.containsKey(independentSeries)) {
    List<ISeries> errors=seriesMap.get(independentSeries);
    if (errors != null && errors.size() > 0) {
      for (      ISeries errSeries : errors) {
        BasicErrorStyle errStyle=(BasicErrorStyle)errSeries.getStyle();
        if (errStyle.getProperty(BasicErrorStyle.ERROR_BAR_TYPE).equals(ErrorBarType.PLUS)) {
          sumArrays(xPlusError,getDoubleValue(errSeries));
        }
 else         if (errStyle.getProperty(BasicErrorStyle.ERROR_BAR_TYPE).equals(ErrorBarType.MINUS)) {
          sumArrays(xMinusError,getDoubleValue(errSeries));
        }
 else         if (errStyle.getProperty(BasicErrorStyle.ERROR_BAR_TYPE).equals(ErrorBarType.BOTH)) {
          sumArrays(xPlusError,getDoubleValue(errSeries));
          sumArrays(xMinusError,getDoubleValue(errSeries));
        }
      }
    }
  }
  XYZSeriesStyle indepStyle=(XYZSeriesStyle)independentSeries.getStyle();
  for (  ISeries iseries : seriesToPlot) {
    ISeries series=(ISeries)iseries;
    Trace trace=configureTrace(series,xValues,xPlusError,xMinusError);
    if (trace != null) {
      trace.setXErrorBarType((ErrorBarType)indepStyle.getProperty(XYZSeriesStyle.ERROR_TYPE));
      this.existingTraces.put(series,trace);
      xyGraph.addTrace(trace);
    }
  }
  xyGraph.repaint();
  return;
}

Fixed version (ground truth):
/** 
 * @param plotProvider
 * @param time
 */
private void showXYGraph(PlotProvider plotProvider,double time,boolean resetTraces){
  if (this.xyGraph == null) {
    xyGraph=new XYGraph();
    graphToolbar=new ToolbarArmedXYGraph(xyGraph);
    lws.setContents(graphToolbar);
    existingTraces.clear();
    xyGraph.setTitle(plotProvider.getPlotTitle());
    XYZPlotStyle plotStyle=plotProvider.getPlotStyle();
    if (plotStyle != null) {
      xyGraph.setTransparent((boolean)plotStyle.getProperty(XYZPlotStyle.IS_TRANSPARENT));
      xyGraph.setBackgroundColor((Color)plotStyle.getProperty(XYZPlotStyle.PLOT_COLOR));
      xyGraph.setShowLegend((boolean)plotStyle.getProperty(XYZPlotStyle.SHOW_LEGEND));
      xyGraph.getPlotArea().setShowBorder((boolean)plotStyle.getProperty(XYZPlotStyle.SHOW_PLOT_BORDER));
    }
    XYZAxisStyle xStyle=plotProvider.getXAxisStyle();
    XYZAxisStyle yStyle=plotProvider.getYAxisStyle();
    configureAxis(xyGraph.primaryXAxis,xStyle);
    configureAxis(xyGraph.primaryYAxis,yStyle);
  }
  lws.setContents(graphToolbar);
  ArrayList<ISeries> seriesToPlot=plotProvider.getSeriesAtTime(time);
  if (seriesToPlot == null) {
    seriesToPlot=new ArrayList<ISeries>();
  }
  double[] xValues=getDoubleValue(independentSeries);
  double[] xPlusError=new double[xValues.length];
  double[] xMinusError=new double[xValues.length];
  if (seriesMap.containsKey(independentSeries)) {
    List<ISeries> errors=seriesMap.get(independentSeries);
    if (errors != null && errors.size() > 0) {
      for (      ISeries errSeries : errors) {
        BasicErrorStyle errStyle=(BasicErrorStyle)errSeries.getStyle();
        if (errStyle.getProperty(BasicErrorStyle.ERROR_BAR_TYPE).equals(ErrorBarType.PLUS)) {
          sumArrays(xPlusError,getDoubleValue(errSeries));
        }
 else         if (errStyle.getProperty(BasicErrorStyle.ERROR_BAR_TYPE).equals(ErrorBarType.MINUS)) {
          sumArrays(xMinusError,getDoubleValue(errSeries));
        }
 else         if (errStyle.getProperty(BasicErrorStyle.ERROR_BAR_TYPE).equals(ErrorBarType.BOTH)) {
          sumArrays(xPlusError,getDoubleValue(errSeries));
          sumArrays(xMinusError,getDoubleValue(errSeries));
        }
      }
    }
  }
  XYZSeriesStyle indepStyle=(XYZSeriesStyle)independentSeries.getStyle();
  for (  ISeries iseries : seriesToPlot) {
    ISeries series=(ISeries)iseries;
    Trace trace=configureTrace(series,xValues,xPlusError,xMinusError);
    if (trace != null) {
      trace.setXErrorBarType((ErrorBarType)indepStyle.getProperty(XYZSeriesStyle.ERROR_TYPE));
      this.existingTraces.put(series,trace);
      if (trace.getTraceColor() == null) {
        List<ISeries> keys=new ArrayList<ISeries>(existingTraces.keySet());
        trace.setTraceColor(XYGraphMediaFactory.getInstance().getColor(XYGraph.DEFAULT_TRACES_COLOR[keys.indexOf(series) % XYGraph.DEFAULT_TRACES_COLOR.length]));
      }
      xyGraph.addTrace(trace);
    }
  }
  return;
}