nus-yam/ex-repair huggingface dataset:
Program: 26443
Project: 26443
Buggy source:
public ReportPanel(NMONVisualizerGui gui,JFrame parent,String reportCacheKey,List<DataSet> dataSets,MultiplexMode multiplexMode){
  super();
  this.chartFactory=new ChartFactory(gui);
  this.chartFactory.setGranularity(gui.getGranularity());
  this.gui=gui;
  this.parent=parent;
  this.dataSets=dataSets;
  this.reportCacheKey=reportCacheKey;
  this.multiplexMode=multiplexMode;
  this.chartsInUse=java.util.Collections.emptyList();
  buildTabs(gui);
  addChangeListener(new ChangeListener(){
    @Override public void stateChanged(    ChangeEvent e){
      if (!buildingTabs) {
        int idx=getSelectedIndex();
        if (idx != -1) {
          if (!updateChart()) {
            firePropertyChange("String_Node_Str",null,getChartPanel(idx));
          }
          if ((previousTab != -1) && (previousTab < getTabCount())) {
            getChartPanel(previousTab).setEnabled(false);
          }
          getChartPanel(idx).setEnabled(true);
          previousTab=idx;
        }
      }
    }
  }
);
  setEnabled(false);
  gui.getIntervalManager().addListener(this);
  gui.addPropertyChangeListener("String_Node_Str",this);
  gui.addPropertyChangeListener("String_Node_Str",this);
}

Fixed version (ground truth):
public ReportPanel(NMONVisualizerGui gui,JFrame parent,String reportCacheKey,List<DataSet> dataSets,MultiplexMode multiplexMode){
  super();
  setTabLayoutPolicy(SCROLL_TAB_LAYOUT);
  this.chartFactory=new ChartFactory(gui);
  this.chartFactory.setGranularity(gui.getGranularity());
  this.gui=gui;
  this.parent=parent;
  this.dataSets=dataSets;
  this.reportCacheKey=reportCacheKey;
  this.multiplexMode=multiplexMode;
  this.chartsInUse=java.util.Collections.emptyList();
  buildTabs(gui);
  addChangeListener(new ChangeListener(){
    @Override public void stateChanged(    ChangeEvent e){
      if (!buildingTabs) {
        int idx=getSelectedIndex();
        if (idx != -1) {
          if (!updateChart()) {
            firePropertyChange("String_Node_Str",null,getChartPanel(idx));
          }
          if ((previousTab != -1) && (previousTab < getTabCount())) {
            getChartPanel(previousTab).setEnabled(false);
          }
          getChartPanel(idx).setEnabled(true);
          previousTab=idx;
        }
      }
    }
  }
);
  setEnabled(false);
  gui.getIntervalManager().addListener(this);
  gui.addPropertyChangeListener("String_Node_Str",this);
  gui.addPropertyChangeListener("String_Node_Str",this);
}
Program: 26445
Project: 26445
Buggy source:
private void writeRawData(Interval interval){
  System.out.println("String_Node_Str" + TimeFormatCache.formatInterval(interval));
  File rawDirectory=createSubdirectory("String_Node_Str",interval);
  System.out.println("String_Node_Str" + rawDirectory.getAbsolutePath());
  for (  DataSet data : getDataSets()) {
    File dataFile=new File(rawDirectory,data.getHostname() + "String_Node_Str");
    FileWriter writer=null;
    try {
      writer=new FileWriter(dataFile);
      System.out.print("String_Node_Str" + data.getHostname() + "String_Node_Str");
      System.out.flush();
      CSVWriter.write(data,interval,writer);
      System.out.println("String_Node_Str");
    }
 catch (    IOException ioe) {
      System.err.println("String_Node_Str" + dataFile.getName());
    }
 finally {
      if (writer != null) {
        try {
          writer.close();
        }
 catch (        IOException ioe) {
        }
      }
    }
  }
}

Fixed version (ground truth):
private void writeRawData(Interval interval){
  System.out.println("String_Node_Str" + TimeFormatCache.formatInterval(interval));
  File rawDirectory=createSubdirectory("String_Node_Str",interval);
  System.out.println("String_Node_Str" + rawDirectory.getAbsolutePath());
  for (  DataSet data : getDataSets()) {
    if (data.getRecordCount(interval) == 0) {
      System.out.println("String_Node_Str" + data.getHostname() + "String_Node_Str");
      continue;
    }
    System.out.print("String_Node_Str" + data.getHostname() + "String_Node_Str");
    System.out.flush();
    File dataFile=new File(rawDirectory,data.getHostname() + "String_Node_Str");
    FileWriter writer=null;
    try {
      writer=new FileWriter(dataFile);
      CSVWriter.write(data,interval,writer);
      System.out.println("String_Node_Str");
    }
 catch (    IOException ioe) {
      System.err.println("String_Node_Str" + dataFile.getName());
    }
 finally {
      if (writer != null) {
        try {
          writer.close();
        }
 catch (        IOException ioe) {
        }
      }
    }
    if (data instanceof ProcessDataSet) {
      ProcessDataSet processData=(ProcessDataSet)data;
      if (processData.getProcessCount() == 0) {
        continue;
      }
      dataFile=new File(rawDirectory,data.getHostname() + "String_Node_Str" + "String_Node_Str");
      writer=null;
      try {
        writer=new FileWriter(dataFile);
        CSVWriter.writeProcesses(data,writer);
        System.out.println("String_Node_Str");
      }
 catch (      IOException ioe) {
        System.err.println("String_Node_Str" + dataFile.getName());
      }
 finally {
        if (writer != null) {
          try {
            writer.close();
          }
 catch (          IOException ioe) {
          }
        }
      }
    }
  }
}
Program: 26447
Project: 26447
Buggy source:
public final int getRecordCount(Interval interval){
  return data.subMap(interval.getStart(),true,interval.getEnd(),true).size();
}

Fixed version (ground truth):
public final int getRecordCount(Interval interval){
  if (Interval.DEFAULT.equals(interval)) {
    return data.size();
  }
 else {
    return data.subMap(interval.getStart(),true,interval.getEnd(),true).size();
  }
}
Program: 26448
Project: 26448
Buggy source:
public static void write(DataTupleCategoryDataset data,Writer writer) throws IOException {
  writer.write(',');
  int columnCount=data.getColumnCount();
  for (int i=0; i < columnCount - 1; i++) {
    writer.write(data.getColumnKey(i).toString());
    writer.write(',');
  }
  writer.write(data.getColumnKey(columnCount - 1).toString());
  writer.write('\n');
  for (int i=0; i < data.getRowCount(); i++) {
    @SuppressWarnings("String_Node_Str") Comparable rowKey=data.getRowKey(i);
    writer.write(rowKey.toString());
    writer.write(',');
    for (int j=0; j < columnCount - 1; j++) {
      Object o=data.getValue(rowKey,data.getColumnKey(j));
      if (o == null) {
        writer.write(format(Double.NaN));
      }
 else {
        writer.write(format(((Double)o).doubleValue()));
      }
      writer.write(',');
    }
    Object o=data.getValue(rowKey,data.getColumnKey(columnCount - 1));
    if (o == null) {
      writer.write(format(Double.NaN));
    }
 else {
      writer.write(format(((Double)o).doubleValue()));
    }
    writer.write('\n');
  }
}

Fixed version (ground truth):
public static void write(DataTupleCategoryDataset data,Writer writer) throws IOException {
  writer.write(',');
  int columnCount=data.getColumnCount();
  for (int i=0; i < columnCount - 1; i++) {
    writer.write(data.getColumnKey(i).toString());
    writer.write(',');
  }
  writer.write(data.getColumnKey(columnCount - 1).toString());
  writer.write('\n');
  for (int i=0; i < data.getRowCount(); i++) {
    @SuppressWarnings("String_Node_Str") Comparable rowKey=data.getRowKey(i);
    writer.write(rowKey.toString());
    writer.write(',');
    for (int j=0; j < columnCount - 1; j++) {
      Object o=data.getValue(rowKey,data.getColumnKey(j));
      if (o == null) {
        writer.write(FORMAT.format(Double.NaN));
      }
 else {
        writer.write(FORMAT.format(((Double)o).doubleValue()));
      }
      writer.write(',');
    }
    Object o=data.getValue(rowKey,data.getColumnKey(columnCount - 1));
    if (o == null) {
      writer.write(FORMAT.format(Double.NaN));
    }
 else {
      writer.write(FORMAT.format(((Double)o).doubleValue()));
    }
    writer.write('\n');
  }
}
Program: 26450
Project: 26450
Buggy source:
/** 
 * Parse the given chart definition XML file and store the report with the given key.
 * @param file a valid XML file for processing by  {@link ChartDefinitionParser}
 */
public void addReport(String key,String file) throws IOException {
  if (DEFAULT_SUMMARY_CHARTS_KEY.equals(key) || DEFAULT_INTERVAL_CHARTS_KEY.equals(key) || DEFAULT_DATASET_CHARTS_KEY.equals(key)) {
    throw new IllegalArgumentException("String_Node_Str" + key);
  }
  reports.put(key,parser.parseCharts(file));
  LOGGER.debug("String_Node_Str",file,key);
}

Fixed version (ground truth):
/** 
 * Parse the given chart definition XML file and store the report with the given key.
 * @param file a valid XML file for processing by {@link ChartDefinitionParser}
 */
public void addReport(String key,String file) throws IOException {
  if (DEFAULT_SUMMARY_CHARTS_KEY.equals(key) || DEFAULT_INTERVAL_CHARTS_KEY.equals(key) || DEFAULT_DATASET_CHARTS_KEY.equals(key)) {
    throw new IllegalArgumentException("String_Node_Str" + key);
  }
  reports.put(key,parser.parseCharts(file));
  LOGGER.debug("String_Node_Str",file,key);
}
Program: 26452
Project: 26452
Buggy source:
private void setAxisTimeZone(TimeZone timeZone){
  if (getChart() != null) {
    XYPlot plot=getChart().getXYPlot();
    if (plot.getDomainAxis() instanceof DateAxis) {
      ((DateAxis)plot.getDomainAxis()).setTimeZone(timeZone);
    }
  }
}

Fixed version (ground truth):
private void setAxisTimeZone(TimeZone timeZone){
  if (getChart() != null) {
    XYPlot plot=getChart().getXYPlot();
    if (plot.getDomainAxis() instanceof DateAxis) {
      ((DateAxis)plot.getDomainAxis()).setTimeZone(timeZone);
      if (plot.getRenderer().getBaseToolTipGenerator().getClass() == TimeAndValueTooltipGenerator.class) {
        ((TimeAndValueTooltipGenerator)plot.getRenderer().getBaseToolTipGenerator()).setTimeZone(timeZone);
      }
    }
  }
}
Program: 26454
Project: 26454
Buggy source:
@Override public void configureChart(JFreeChart chart){
  if (app.getBooleanProperty("String_Node_Str")) {
    LineChartBuilder.setRelativeAxis(chart,app.getMinSystemTime());
  }
 else {
    LineChartBuilder.setAbsoluteAxis(chart);
  }
  DateAxis axis=(DateAxis)chart.getXYPlot().getDomainAxis();
  Interval current=app.getIntervalManager().getCurrentInterval();
  axis.setTimeZone(app.getDisplayTimeZone());
  if (Interval.DEFAULT.equals(current)) {
    if (app.getMinSystemTime() == 0) {
      long now=System.currentTimeMillis();
      axis.setRange(now - (86400000 / 2),now + ((86400000 - 1000) / 2));
    }
 else {
      long min=app.getMinSystemTime();
      long max=app.getMaxSystemTime();
      if (min == max) {
        min-=1000;
      }
      axis.setRange(min,max);
    }
  }
 else {
    axis.setRange(current.getStart(),current.getEnd());
  }
}

Fixed version (ground truth):
@Override public void configureChart(JFreeChart chart){
  if (app.getBooleanProperty("String_Node_Str")) {
    LineChartBuilder.setRelativeAxis(chart,app.getMinSystemTime());
  }
 else {
    LineChartBuilder.setAbsoluteAxis(chart);
  }
  DateAxis axis=(DateAxis)chart.getXYPlot().getDomainAxis();
  Interval current=app.getIntervalManager().getCurrentInterval();
  axis.setTimeZone(app.getDisplayTimeZone());
  if (chart.getXYPlot().getRenderer().getBaseToolTipGenerator().getClass() == TimeAndValueTooltipGenerator.class) {
    ((TimeAndValueTooltipGenerator)chart.getXYPlot().getRenderer().getBaseToolTipGenerator()).setTimeZone(app.getDisplayTimeZone());
  }
  if (Interval.DEFAULT.equals(current)) {
    if (app.getMinSystemTime() == 0) {
      long now=System.currentTimeMillis();
      axis.setRange(now - (86400000 / 2),now + ((86400000 - 1000) / 2));
    }
 else {
      long min=app.getMinSystemTime();
      long max=app.getMaxSystemTime();
      if (min == max) {
        min-=1000;
      }
      axis.setRange(min,max);
    }
  }
 else {
    axis.setRange(current.getStart(),current.getEnd());
  }
}
Program: 26458
Project: 26458
Buggy source:
public final Iterable<DataRecord> getRecords(Interval interval){
  return java.util.Collections.unmodifiableCollection(data.subMap(interval.getStart(),true,interval.getEnd(),true).values());
}

Fixed version (ground truth):
public final Iterable<DataRecord> getRecords(Interval interval){
  if (Interval.DEFAULT.equals(interval)) {
    return java.util.Collections.unmodifiableCollection(data.values());
  }
 else {
    return java.util.Collections.unmodifiableCollection(data.subMap(interval.getStart(),true,interval.getEnd(),true).values());
  }
}
Program: 26460
Project: 26460
Buggy source:
@Override public void postProcess(DataSet data,DataRecord record){
  DataType total=data.getType("String_Node_Str" + "String_Node_Str");
  if (total == null) {
    return;
  }
  double[] totalData=new double[total.getFieldCount()];
  for (int i=0; i < totalData.length; i++) {
    totalData[i]=0;
  }
  for (  DataType type : data.getTypes()) {
    if (type.getId().contains("String_Node_Str") && (type != total)) {
      if (record.hasData(type)) {
        double[] typeData=record.getData(type);
        for (int i=0; i < total.getFieldCount(); i++) {
          totalData[i]+=typeData[i];
        }
      }
    }
  }
  record.addData(total,totalData);
}

Fixed version (ground truth):
@Override public void postProcess(DataSet data,DataRecord record){
  DataType total=data.getType("String_Node_Str" + "String_Node_Str");
  if (total == null) {
    return;
  }
  int totalFieldCount=total.getFieldCount();
  double[] totalData=new double[totalFieldCount];
  for (int i=0; i < totalData.length; i++) {
    totalData[i]=0;
  }
  for (  DataType type : data.getTypes()) {
    if (type.getId().startsWith("String_Node_Str") && (type != total)) {
      if (record.hasData(type)) {
        double[] typeData=record.getData(type);
        for (int i=0; i < totalFieldCount; i++) {
          totalData[i]+=typeData[i];
        }
      }
    }
  }
  record.addData(total,totalData);
}
Program: 26461
Project: 26461
Buggy source:
/** 
 * Defines how granular charts will be, i.e. how many seconds will pass between data points. This method causes either a <code>automaticGranularity</code> or <code>granularity</code> property change event to be fired.
 * @param granularity the new granularity, in seconds. A zero or negative value implies that granularity will be automatically calculated based on the current interval.
 */
public void setGranularity(int granularity){
  int oldGranularity=getGranularity();
  if (granularity <= 0) {
    if (getBooleanProperty("String_Node_Str")) {
      granularityHelper.recalculate();
    }
 else {
      granularityHelper.setAutomatic(true);
      setProperty("String_Node_Str",true);
    }
  }
 else {
    granularityHelper.setGranularity(granularity);
    if (getBooleanProperty("String_Node_Str")) {
      setProperty("String_Node_Str",false);
    }
  }
  if (getGranularity() != oldGranularity) {
    setProperty("String_Node_Str",getGranularity());
  }
}

Fixed version (ground truth):
/** 
 * Defines how granular charts will be, i.e. how many seconds will pass between data points. This method causes either a <code>automaticGranularity</code> or <code>granularity</code> property change event to be fired.
 * @param granularity the new granularity, in seconds. A zero or negative value implies that granularity will be automatically calculated based on the current interval.
 */
public void setGranularity(int granularity){
  int oldGranularity=getGranularity();
  if (granularity <= 0) {
    if (getBooleanProperty("String_Node_Str")) {
      granularityHelper.recalculate();
    }
 else {
      granularityHelper.setAutomatic(true);
      setProperty("String_Node_Str",true);
    }
  }
 else {
    granularityHelper.setGranularity(granularity);
    if (getBooleanProperty("String_Node_Str")) {
      setProperty("String_Node_Str",false);
    }
  }
  if (getGranularity() != oldGranularity) {
    for (    DataSet data : getDataSets()) {
      getAnalysis(data).setGranularity(getGranularity());
    }
    setProperty("String_Node_Str",getGranularity());
  }
}
Program: 26462
Project: 26462
Buggy source:
public SubDataType(String id,String subId,String name,boolean displayPrimaryId,String... fields){
  super(buildId(id,subId),name,fields);
  if ((subId == null) || subId.equals("String_Node_Str")) {
    throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str");
  }
  this.subId=subId;
  if (displayPrimaryId) {
    this.asString=buildId(id,subId);
  }
 else {
    this.asString=subId;
  }
}

Fixed version (ground truth):
public SubDataType(String id,String subId,String name,boolean displayPrimaryId,String... fields){
  super(buildId(id,subId),name,fields);
  if ((subId == null) || subId.equals("String_Node_Str")) {
    throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str");
  }
  this.subId=subId;
  if (displayPrimaryId) {
    this.asString=this.id;
  }
 else {
    this.asString=this.subId;
  }
}
Program: 26463
Project: 26463
Buggy source:
public OSMatcher(String operatingSystem){
  if ((operatingSystem == null) || "String_Node_Str".equals(operatingSystem)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  operatingSystem=operatingSystem.toLowerCase();
  if (operatingSystem.contains("String_Node_Str")) {
    matcher=LINUX;
  }
 else   if (operatingSystem.contains("String_Node_Str")) {
    matcher=AIX;
  }
 else   if (operatingSystem.contains("String_Node_Str")) {
    matcher=VIOS;
  }
 else   if (operatingSystem.contains("String_Node_Str")) {
    matcher=PERFMON;
  }
 else {
    matcher=UNKNOWN;
  }
}

Fixed version (ground truth):
public OSMatcher(String operatingSystem){
  super("String_Node_Str");
  if ((operatingSystem == null) || "String_Node_Str".equals(operatingSystem)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  operatingSystem=operatingSystem.toLowerCase();
  if (operatingSystem.contains("String_Node_Str")) {
    matcher=LINUX;
  }
 else   if (operatingSystem.contains("String_Node_Str")) {
    matcher=AIX;
  }
 else   if (operatingSystem.contains("String_Node_Str")) {
    matcher=VIOS;
  }
 else   if (operatingSystem.contains("String_Node_Str")) {
    matcher=UNIX;
  }
 else   if (operatingSystem.contains("String_Node_Str")) {
    matcher=PERFMON;
  }
 else {
    matcher=UNKNOWN;
  }
}
Program: 26464
Project: 26464
Buggy source:
private String getAxisLabel(DataType type,String field){
  String label=FIELD_AXIS_NAMES.get(field);
  if (label != null) {
    return label;
  }
 else   if (field.endsWith("String_Node_Str")) {
    return "String_Node_Str";
  }
 else   if (field.contains("String_Node_Str")) {
    return "String_Node_Str";
  }
 else   if (field.startsWith("String_Node_Str")) {
    return "String_Node_Str";
  }
 else   if (field.startsWith("String_Node_Str")) {
    return "String_Node_Str";
  }
 else   if (field.endsWith("String_Node_Str")) {
    return "String_Node_Str";
  }
 else   if (field.endsWith("String_Node_Str")) {
    return "String_Node_Str";
  }
 else   if (field.contains("String_Node_Str")) {
    return "String_Node_Str";
  }
 else   if (field.contains("String_Node_Str")) {
    return "String_Node_Str";
  }
 else   if (field.endsWith("String_Node_Str")) {
    return "String_Node_Str";
  }
 else   if (field.contains("String_Node_Str")) {
    return "String_Node_Str";
  }
 else {
    return getAxisLabel(type);
  }
}

Fixed version (ground truth):
private String getAxisLabel(DataType type,String field){
  String label=FIELD_AXIS_NAMES.get(field);
  if (label != null) {
    return label;
  }
 else   if (field.endsWith("String_Node_Str")) {
    return "String_Node_Str";
  }
 else   if (field.contains("String_Node_Str")) {
    return "String_Node_Str";
  }
 else   if (field.startsWith("String_Node_Str")) {
    return "String_Node_Str";
  }
 else   if (field.startsWith("String_Node_Str")) {
    return "String_Node_Str";
  }
 else   if (field.endsWith("String_Node_Str")) {
    return "String_Node_Str";
  }
 else   if (field.endsWith("String_Node_Str")) {
    return "String_Node_Str";
  }
 else   if (field.toLowerCase().contains("String_Node_Str")) {
    return "String_Node_Str";
  }
 else   if (field.toLowerCase().contains("String_Node_Str")) {
    return "String_Node_Str";
  }
 else   if (field.toLowerCase().contains("String_Node_Str")) {
    return "String_Node_Str";
  }
 else   if (field.toLowerCase().contains("String_Node_Str")) {
    return "String_Node_Str";
  }
 else   if (field.contains("String_Node_Str")) {
    return "String_Node_Str";
  }
 else   if (field.endsWith("String_Node_Str")) {
    return "String_Node_Str";
  }
 else   if (field.endsWith("String_Node_Str")) {
    return "String_Node_Str";
  }
 else {
    return getAxisLabel(type);
  }
}
Program: 26465
Project: 26465
Buggy source:
@Override public void dataAdded(DataSet data){
  singleIntervalReport.addData(data);
  allIntervalsReport.addData(data);
  int index=singleIntervalReport.getPreviousTab();
  if (index != -1) {
    singleIntervalReport.setSelectedIndex(index);
  }
 else {
    singleIntervalReport.setSelectedIndex(0);
  }
  index=allIntervalsReport.getPreviousTab();
  if (index != -1) {
    allIntervalsReport.setSelectedIndex(index);
  }
 else {
    allIntervalsReport.setSelectedIndex(0);
  }
  addBorderIfNecessary();
}

Fixed version (ground truth):
@Override public void dataAdded(DataSet data){
  singleIntervalReport.addData(data);
  allIntervalsReport.addData(data);
  int index=singleIntervalReport.getPreviousTab();
  if (index != -1) {
    if (index >= singleIntervalReport.getTabCount()) {
      index=singleIntervalReport.getTabCount() - 1;
    }
    singleIntervalReport.setSelectedIndex(index);
  }
 else {
    singleIntervalReport.setSelectedIndex(0);
  }
  index=allIntervalsReport.getPreviousTab();
  if (index != -1) {
    if (index >= allIntervalsReport.getTabCount()) {
      index=allIntervalsReport.getTabCount() - 1;
    }
    allIntervalsReport.setSelectedIndex(index);
  }
 else {
    allIntervalsReport.setSelectedIndex(0);
  }
  addBorderIfNecessary();
}
Program: 26466
Project: 26466
Buggy source:
public ReportPanel(NMONVisualizerGui gui,JFrame parent,String reportCacheKey,List<DataSet> dataSets,MultiplexMode multiplexMode){
  super();
  this.chartFactory=new ChartFactory(gui);
  this.gui=gui;
  this.parent=parent;
  this.dataSets=dataSets;
  this.reportCacheKey=reportCacheKey;
  this.multiplexMode=multiplexMode;
  List<BaseChartDefinition> reports=gui.getReportCache().getReport(reportCacheKey);
  this.chartsInUse=new java.util.ArrayList<BaseChartDefinition>(reports.size());
  this.chartNeedsUpdate=new BitSet(reports.size());
  this.chartNeedsUpdate.set(0,chartNeedsUpdate.size(),true);
  buildTabs(gui);
  addChangeListener(new ChangeListener(){
    @Override public void stateChanged(    ChangeEvent e){
      if (!buildingTabs) {
        int idx=getSelectedIndex();
        if (idx != -1) {
          if (!updateChart()) {
            firePropertyChange("String_Node_Str",null,getChartPanel(idx));
          }
          if ((previousTab != -1) && (previousTab < getTabCount())) {
            getChartPanel(previousTab).setEnabled(false);
          }
          getChartPanel(idx).setEnabled(true);
          previousTab=idx;
        }
      }
    }
  }
);
  setEnabled(false);
  gui.getIntervalManager().addListener(this);
  gui.addPropertyChangeListener("String_Node_Str",this);
  gui.addPropertyChangeListener("String_Node_Str",this);
}

Fixed version (ground truth):
public ReportPanel(NMONVisualizerGui gui,JFrame parent,String reportCacheKey,List<DataSet> dataSets,MultiplexMode multiplexMode){
  super();
  this.chartFactory=new ChartFactory(gui);
  this.chartFactory.setGranularity(gui.getGranularity());
  this.gui=gui;
  this.parent=parent;
  this.dataSets=dataSets;
  this.reportCacheKey=reportCacheKey;
  this.multiplexMode=multiplexMode;
  List<BaseChartDefinition> reports=gui.getReportCache().getReport(reportCacheKey);
  this.chartsInUse=new java.util.ArrayList<BaseChartDefinition>(reports.size());
  this.chartNeedsUpdate=new BitSet(reports.size());
  this.chartNeedsUpdate.set(0,chartNeedsUpdate.size(),true);
  buildTabs(gui);
  addChangeListener(new ChangeListener(){
    @Override public void stateChanged(    ChangeEvent e){
      if (!buildingTabs) {
        int idx=getSelectedIndex();
        if (idx != -1) {
          if (!updateChart()) {
            firePropertyChange("String_Node_Str",null,getChartPanel(idx));
          }
          if ((previousTab != -1) && (previousTab < getTabCount())) {
            getChartPanel(previousTab).setEnabled(false);
          }
          getChartPanel(idx).setEnabled(true);
          previousTab=idx;
        }
      }
    }
  }
);
  setEnabled(false);
  gui.getIntervalManager().addListener(this);
  gui.addPropertyChangeListener("String_Node_Str",this);
  gui.addPropertyChangeListener("String_Node_Str",this);
}
Program: 26467
Project: 26467
Buggy source:
@Override public double[] transform(DataType type,double[] data){
  double[] newData=new double[data.length + 4];
  newData[0]=data[0];
  newData[1]=data[1];
  newData[2]=100 - data[0];
  newData[3]=100 - data[1];
  newData[4]=data[2];
  newData[5]=data[3];
  newData[6]=data[4] - data[2];
  newData[7]=data[5] - data[3];
  newData[8]=data[4];
  newData[9]=data[5];
  return newData;
}

Fixed version (ground truth):
@Override public double[] transform(DataType type,double[] data){
  double[] newData=new double[data.length + 4];
  newData[0]=data[0];
  newData[1]=data[1];
  newData[2]=100 - data[0];
  newData[3]=100 - data[1];
  newData[4]=data[2];
  newData[5]=data[3];
  newData[6]=data[4] - data[2];
  newData[7]=data[5] - data[3];
  for (int i=4; i < data.length; i++) {
    newData[i + 4]=data[i];
  }
  return newData;
}
Program: 26470
Project: 26470
Buggy source:
protected JFreeChart createChart(){
  CategoryAxis categoryAxis=new CategoryAxis();
  ValueAxis valueAxis=new NumberAxis();
  BarRenderer renderer=null;
  if (definition.isStacked()) {
    renderer=new StackedBarRenderer();
  }
 else {
    renderer=new BarRenderer();
  }
  CategoryPlot plot=new CategoryPlot(new DataTupleCategoryDataset(false),categoryAxis,valueAxis,renderer);
  if (definition.hasSecondaryYAxis()) {
    plot.setDataset(1,new DataTupleCategoryDataset(definition.isStacked()));
    valueAxis=new NumberAxis();
    plot.setRenderer(1,new BarRenderer());
    plot.setRangeAxis(1,valueAxis);
    plot.mapDatasetToRangeAxis(1,1);
  }
  return new HighlightableBarChart("String_Node_Str",JFreeChart.DEFAULT_TITLE_FONT,plot,false);
}

Fixed version (ground truth):
protected JFreeChart createChart(){
  CategoryAxis categoryAxis=new CategoryAxis();
  ValueAxis valueAxis=new NumberAxis();
  BarRenderer renderer=null;
  if (definition.isStacked()) {
    renderer=new StackedBarRenderer();
  }
 else {
    renderer=new BarRenderer();
  }
  CategoryPlot plot=new CategoryPlot(new DataTupleCategoryDataset(false),categoryAxis,valueAxis,renderer);
  if (definition.hasSecondaryYAxis()) {
    plot.setDataset(1,new DataTupleCategoryDataset(false));
    valueAxis=new NumberAxis();
    plot.setRenderer(1,new BarRenderer());
    plot.setRangeAxis(1,valueAxis);
    plot.mapDatasetToRangeAxis(1,1);
  }
  return new HighlightableBarChart("String_Node_Str",JFreeChart.DEFAULT_TITLE_FONT,plot,false);
}
Program: 26471
Project: 26471
Buggy source:
@Override protected JFreeChart createChart(){
  CategoryAxis categoryAxis=new CategoryAxis();
  NumberAxis valueAxis=new NumberAxis();
  valueAxis.setAutoRangeIncludesZero(true);
  LineAndShapeRenderer renderer=new LineAndShapeRenderer();
  renderer.setBaseSeriesVisible(true,false);
  CategoryPlot plot=new CategoryPlot(new DataTupleCategoryDataset(true),categoryAxis,valueAxis,renderer);
  if (definition.hasSecondaryYAxis()) {
    plot.setDataset(1,new DataTupleCategoryDataset(false));
    valueAxis=new NumberAxis();
    valueAxis.setAutoRangeIncludesZero(true);
    renderer=new LineAndShapeRenderer();
    renderer.setBaseSeriesVisible(true,false);
    plot.setRenderer(1,renderer);
    plot.setRangeAxis(1,valueAxis);
    plot.mapDatasetToRangeAxis(1,1);
  }
  return new JFreeChart("String_Node_Str",null,plot,false);
}

Fixed version (ground truth):
@Override protected JFreeChart createChart(){
  CategoryAxis categoryAxis=new CategoryAxis();
  NumberAxis valueAxis=new NumberAxis();
  valueAxis.setAutoRangeIncludesZero(true);
  LineAndShapeRenderer renderer=new LineAndShapeRenderer();
  renderer.setBaseSeriesVisible(true,false);
  CategoryPlot plot=new CategoryPlot(new DataTupleCategoryDataset(true),categoryAxis,valueAxis,renderer);
  if (definition.hasSecondaryYAxis()) {
    plot.setDataset(1,new DataTupleCategoryDataset(true));
    valueAxis=new NumberAxis();
    valueAxis.setAutoRangeIncludesZero(true);
    renderer=new LineAndShapeRenderer();
    renderer.setBaseSeriesVisible(true,false);
    plot.setRenderer(1,renderer);
    plot.setRangeAxis(1,valueAxis);
    plot.mapDatasetToRangeAxis(1,1);
  }
  return new JFreeChart("String_Node_Str",null,plot,false);
}
Program: 26472
Project: 26472
Buggy source:
public final DataTupleCategoryDataset merge(DataTupleCategoryDataset other){
  DataTupleCategoryDataset toReturn=new DataTupleCategoryDataset(this.categoriesHaveDifferentStats | other.categoriesHaveDifferentStats);
  toReturn.tuples.putAll(this.tuples);
  toReturn.tuples.putAll(other.tuples);
  return toReturn;
}

Fixed version (ground truth):
public final DataTupleCategoryDataset merge(DataTupleCategoryDataset other){
  DataTupleCategoryDataset toReturn=new DataTupleCategoryDataset(other.containsIntervals());
  toReturn.categoriesHaveDifferentStats=this.categoriesHaveDifferentStats | other.categoriesHaveDifferentStats;
  toReturn.tuples.putAll(this.tuples);
  toReturn.tuples.putAll(other.tuples);
  return toReturn;
}
Program: 26475
Project: 26475
Buggy source:
public boolean accept(String pathname){
  String name=pathname.toLowerCase();
  return name.contains("String_Node_Str");
}

Fixed version (ground truth):
public boolean accept(String pathname){
  String name=pathname.toLowerCase();
  if (name.endsWith("String_Node_Str")) {
    return true;
  }
 else {
    int idx=name.lastIndexOf('/');
    if (idx != -1) {
      name=pathname.substring(idx + 1);
    }
    return name.contains("String_Node_Str") && !(name.endsWith("String_Node_Str") || name.endsWith("String_Node_Str") || name.endsWith("String_Node_Str")|| name.endsWith("String_Node_Str"));
  }
}
Program: 26476
Project: 26476
Buggy source:
public boolean accept(String pathname){
  if (pathname.endsWith("String_Node_Str")) {
    return true;
  }
 else {
    int idx=pathname.lastIndexOf('/');
    if (idx == -1) {
      return pathname.contains("String_Node_Str");
    }
 else {
      return pathname.substring(idx + 1).contains("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
public boolean accept(String pathname){
  String name=pathname.toLowerCase();
  if (name.endsWith("String_Node_Str")) {
    return true;
  }
 else {
    int idx=name.lastIndexOf('/');
    if (idx != -1) {
      name=pathname.substring(idx + 1);
    }
    return name.contains("String_Node_Str") && !(name.endsWith("String_Node_Str") || name.endsWith("String_Node_Str") || name.endsWith("String_Node_Str")|| name.endsWith("String_Node_Str"));
  }
}
Program: 26477
Project: 26477
Buggy source:
public BarChartDefinition(BarChartDefinition copy,boolean copyData){
  super(copy,copyData);
  this.subtractionNeeded=copy.subtractionNeeded;
  this.categoryAxisLabel=copy.categoryAxisLabel;
  this.categoryNamingMode=copy.categoryNamingMode;
}

Fixed version (ground truth):
public BarChartDefinition(BarChartDefinition copy,boolean copyData){
  super(copy,copyData);
  this.subtractionNeeded=copy.subtractionNeeded;
  this.categoryAxisLabel=copy.categoryAxisLabel;
  this.barNamingMode=copy.barNamingMode;
  this.categoryNamingMode=copy.categoryNamingMode;
}
Program: 26478
Project: 26478
Buggy source:
@Override protected void finalize() throws Throwable {
  super.finalize();
  gui.removePropertyChangeListener("String_Node_Str",this);
}

Fixed version (ground truth):
@Override protected void finalize() throws Throwable {
  super.finalize();
  gui.removePropertyChangeListener("String_Node_Str",this);
  gui.getIntervalManager().removeListener(this);
}
Program: 26481
Project: 26481
Buggy source:
private void updateChart(){
  recalculateGapThreshold(0);
  if (hasSecondaryYAxis) {
    recalculateGapThreshold(1);
  }
  chart.getXYPlot().getRangeAxis(0).configure();
  if (chart.getLegend() == null) {
    int seriesCount=chart.getXYPlot().getDataset(0).getSeriesCount();
    if (hasSecondaryYAxis) {
      seriesCount+=chart.getXYPlot().getDataset(1).getSeriesCount();
      NumberAxis a=(NumberAxis)chart.getXYPlot().getRangeAxis(1);
      a.configure();
    }
    if (seriesCount > 1) {
      addLegend();
    }
  }
}

Fixed version (ground truth):
private void updateChart(){
  recalculateGapThreshold(0);
  if (hasSecondaryYAxis) {
    recalculateGapThreshold(1);
  }
  chart.getXYPlot().configureRangeAxes();
  if (chart.getLegend() == null) {
    int seriesCount=chart.getXYPlot().getDataset(0).getSeriesCount();
    if (hasSecondaryYAxis) {
      seriesCount+=chart.getXYPlot().getDataset(1).getSeriesCount();
    }
    if (seriesCount > 1) {
      addLegend();
    }
  }
}
Program: 26482
Project: 26482
Buggy source:
protected JFreeChart createChart(){
  CategoryAxis categoryAxis=new CategoryAxis();
  ValueAxis valueAxis=new NumberAxis();
  BarRenderer renderer=null;
  if (stacked) {
    renderer=new StackedBarRenderer();
  }
 else {
    renderer=new BarRenderer();
  }
  CategoryPlot plot=new CategoryPlot(new DataTupleCategoryDataset(false),categoryAxis,valueAxis,renderer);
  if (hasSecondaryYAxis) {
    plot.setRenderer(1,new BarRenderer());
    plot.mapDatasetToRangeAxis(1,1);
  }
  return new HighlightableBarChart("String_Node_Str",JFreeChart.DEFAULT_TITLE_FONT,plot,false);
}

Fixed version (ground truth):
protected JFreeChart createChart(){
  CategoryAxis categoryAxis=new CategoryAxis();
  ValueAxis valueAxis=new NumberAxis();
  BarRenderer renderer=null;
  if (stacked) {
    renderer=new StackedBarRenderer();
  }
 else {
    renderer=new BarRenderer();
  }
  CategoryPlot plot=new CategoryPlot(new DataTupleCategoryDataset(false),categoryAxis,valueAxis,renderer);
  if (hasSecondaryYAxis) {
    plot.setDataset(1,new DataTupleCategoryDataset(stacked));
    valueAxis=new NumberAxis();
    plot.setRenderer(1,new BarRenderer());
    plot.setRangeAxis(1,valueAxis);
    plot.mapDatasetToRangeAxis(1,1);
  }
  return new HighlightableBarChart("String_Node_Str",JFreeChart.DEFAULT_TITLE_FONT,plot,false);
}
Program: 26483
Project: 26483
Buggy source:
public void initChart(BarChartDefinition definition){
  stacked=definition.isStacked();
  hasSecondaryYAxis=definition.hasSecondaryYAxis();
  initChart();
  if (definition.usePercentYAxis()) {
    setPercentYAxis();
  }
  chart.setTitle(definition.getTitle());
  ((CategoryPlot)chart.getPlot()).getRangeAxis().setLabel(definition.getYAxisLabel());
  ((CategoryPlot)chart.getPlot()).getDomainAxis().setLabel(definition.getCategoryAxisLabel());
  if (hasSecondaryYAxis) {
    ((CategoryPlot)chart.getPlot()).getRangeAxis(1).setLabel(definition.getSecondaryYAxisLabel());
  }
}

Fixed version (ground truth):
public void initChart(BarChartDefinition definition){
  stacked=definition.isStacked();
  hasSecondaryYAxis=definition.hasSecondaryYAxis();
  initChart();
  chart.setTitle(definition.getTitle());
  CategoryPlot plot=(CategoryPlot)chart.getPlot();
  plot.getRangeAxis().setLabel(definition.getYAxisLabel());
  if (hasSecondaryYAxis) {
    plot.getRangeAxis(1).setLabel(definition.getSecondaryYAxisLabel());
  }
  plot.getDomainAxis().setLabel(definition.getCategoryAxisLabel());
  if (definition.usePercentYAxis()) {
    setPercentYAxis();
  }
}
Program: 26484
Project: 26484
Buggy source:
@Override protected JFreeChart createChart(){
  CategoryAxis categoryAxis=new CategoryAxis();
  NumberAxis valueAxis=new NumberAxis();
  valueAxis.setAutoRangeIncludesZero(true);
  LineAndShapeRenderer renderer=new LineAndShapeRenderer();
  renderer.setBaseSeriesVisible(true,false);
  CategoryPlot plot=new CategoryPlot(new DataTupleCategoryDataset(true),categoryAxis,valueAxis,renderer);
  if (hasSecondaryYAxis) {
    renderer=new LineAndShapeRenderer();
    renderer.setBaseSeriesVisible(true,false);
    plot.setRenderer(1,renderer);
    plot.mapDatasetToRangeAxis(1,1);
  }
  return new JFreeChart("String_Node_Str",null,plot,false);
}

Fixed version (ground truth):
@Override protected JFreeChart createChart(){
  CategoryAxis categoryAxis=new CategoryAxis();
  NumberAxis valueAxis=new NumberAxis();
  valueAxis.setAutoRangeIncludesZero(true);
  LineAndShapeRenderer renderer=new LineAndShapeRenderer();
  renderer.setBaseSeriesVisible(true,false);
  CategoryPlot plot=new CategoryPlot(new DataTupleCategoryDataset(true),categoryAxis,valueAxis,renderer);
  if (hasSecondaryYAxis) {
    plot.setDataset(1,new DataTupleCategoryDataset(stacked));
    valueAxis=new NumberAxis();
    valueAxis.setAutoRangeIncludesZero(true);
    renderer=new LineAndShapeRenderer();
    renderer.setBaseSeriesVisible(true,false);
    plot.setRenderer(1,renderer);
    plot.setRangeAxis(1,valueAxis);
    plot.mapDatasetToRangeAxis(1,1);
  }
  return new JFreeChart("String_Node_Str",null,plot,false);
}
Program: 26485
Project: 26485
Buggy source:
@Override protected void formatChart(){
  super.formatChart();
  CategoryPlot plot=(CategoryPlot)chart.getPlot();
  LineAndShapeRenderer renderer=(LineAndShapeRenderer)plot.getRenderer();
  renderer.setBaseShapesVisible(true);
  renderer.setBaseShapesFilled(true);
  renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator("String_Node_Str",new DecimalFormat("String_Node_Str")));
  plot.getDomainAxis().setLowerMargin(.015);
  plot.getDomainAxis().setUpperMargin(.015);
  for (int i=0; i < plot.getRangeAxisCount(); i++) {
    plot.getRangeAxis(i).setLabelFont(LABEL_FONT);
    plot.getRangeAxis(i).setTickLabelFont(AXIS_FONT);
  }
  plot.getDomainAxis().setLabelFont(LABEL_FONT);
  plot.getDomainAxis().setTickLabelFont(AXIS_FONT);
  plot.getDomainAxis().setLowerMargin(.015);
  plot.getDomainAxis().setUpperMargin(.015);
  plot.getDomainAxis().setCategoryMargin(0);
  plot.setRangeGridlinePaint(GRID_COLOR);
  plot.setRangeGridlineStroke(GRID_LINES);
}

Fixed version (ground truth):
@Override protected void formatChart(){
  super.formatChart();
  CategoryPlot plot=(CategoryPlot)chart.getPlot();
  for (int i=0; i < plot.getRendererCount(); i++) {
    LineAndShapeRenderer renderer=(LineAndShapeRenderer)plot.getRenderer(i);
    renderer.setBaseShapesVisible(true);
    renderer.setBaseShapesFilled(true);
    renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator("String_Node_Str",new DecimalFormat("String_Node_Str")));
    plot.getRangeAxis(i).setLabelFont(LABEL_FONT);
    plot.getRangeAxis(i).setTickLabelFont(AXIS_FONT);
  }
  plot.getDomainAxis().setLowerMargin(.015);
  plot.getDomainAxis().setUpperMargin(.015);
  plot.getDomainAxis().setLabelFont(LABEL_FONT);
  plot.getDomainAxis().setTickLabelFont(AXIS_FONT);
  plot.getDomainAxis().setLowerMargin(.015);
  plot.getDomainAxis().setUpperMargin(.015);
  plot.getDomainAxis().setCategoryMargin(0);
  plot.setRangeGridlinePaint(GRID_COLOR);
  plot.setRangeGridlineStroke(GRID_LINES);
}
Program: 26486
Project: 26486
Buggy source:
public void initChart(IntervalChartDefinition definition){
  initChart();
  if (definition.usePercentYAxis()) {
    setPercentYAxis();
  }
  chart.setTitle(definition.getTitle());
  CategoryPlot plot=(CategoryPlot)chart.getPlot();
  plot.getRangeAxis().setLabel(definition.getYAxisLabel());
  if (hasSecondaryYAxis) {
    ((CategoryPlot)chart.getPlot()).getRangeAxis(1).setLabel(definition.getSecondaryYAxisLabel());
  }
  if ("String_Node_Str".equals(definition.getXAxisLabel())) {
    plot.getDomainAxis().setLabel("String_Node_Str");
  }
 else {
    plot.getDomainAxis().setLabel(definition.getXAxisLabel());
  }
}

Fixed version (ground truth):
public void initChart(IntervalChartDefinition definition){
  hasSecondaryYAxis=definition.hasSecondaryYAxis();
  initChart();
  chart.setTitle(definition.getTitle());
  CategoryPlot plot=(CategoryPlot)chart.getPlot();
  plot.getRangeAxis().setLabel(definition.getYAxisLabel());
  if (hasSecondaryYAxis) {
    plot.getRangeAxis(1).setLabel(definition.getSecondaryYAxisLabel());
  }
  if ("String_Node_Str".equals(definition.getXAxisLabel())) {
    plot.getDomainAxis().setLabel("String_Node_Str");
  }
 else {
    plot.getDomainAxis().setLabel(definition.getXAxisLabel());
  }
  if (definition.usePercentYAxis()) {
    setPercentYAxis();
  }
}
Program: 26487
Project: 26487
Buggy source:
protected JFreeChart createChart(){
  DateAxis timeAxis=new DateAxis();
  NumberAxis valueAxis=new NumberAxis();
  valueAxis.setAutoRangeIncludesZero(true);
  DataTupleXYDataset dataset=new DataTupleXYDataset(stacked);
  XYPlot plot=null;
  if (stacked) {
    StackedXYAreaRenderer2 renderer=new StackedXYAreaRenderer2();
    renderer.setBaseSeriesVisible(true,false);
    plot=new XYPlot(dataset,timeAxis,valueAxis,renderer);
  }
 else {
    StandardXYItemRenderer renderer=new StandardXYItemRenderer();
    renderer.setBaseSeriesVisible(true,false);
    plot=new XYPlot(dataset,timeAxis,valueAxis,renderer);
  }
  if (hasSecondaryYAxis) {
    plot.setDataset(1,new DataTupleXYDataset(stacked));
    valueAxis=new NumberAxis();
    valueAxis.setAutoRangeIncludesZero(true);
    plot.setRangeAxis(1,valueAxis);
    plot.mapDatasetToRangeAxis(1,1);
    StandardXYItemRenderer renderer=new StandardXYItemRenderer();
    renderer.setBaseSeriesVisible(true,false);
    plot.setRenderer(1,renderer);
  }
  return new JFreeChart("String_Node_Str",null,plot,false);
}

Fixed version (ground truth):
protected JFreeChart createChart(){
  DateAxis timeAxis=new DateAxis();
  NumberAxis valueAxis=new NumberAxis();
  valueAxis.setAutoRangeIncludesZero(true);
  DataTupleXYDataset dataset=new DataTupleXYDataset(stacked);
  XYPlot plot=null;
  if (stacked) {
    StackedXYAreaRenderer2 renderer=new StackedXYAreaRenderer2();
    renderer.setBaseSeriesVisible(true,false);
    plot=new XYPlot(dataset,timeAxis,valueAxis,renderer);
  }
 else {
    StandardXYItemRenderer renderer=new StandardXYItemRenderer();
    renderer.setBaseSeriesVisible(true,false);
    plot=new XYPlot(dataset,timeAxis,valueAxis,renderer);
  }
  if (hasSecondaryYAxis) {
    plot.setDataset(1,new DataTupleXYDataset(stacked));
    valueAxis=new NumberAxis();
    valueAxis.setAutoRangeIncludesZero(true);
    StandardXYItemRenderer renderer=new StandardXYItemRenderer();
    renderer.setBaseSeriesVisible(true,false);
    plot.setRangeAxis(1,valueAxis);
    plot.setRenderer(1,renderer);
    plot.mapDatasetToRangeAxis(1,1);
  }
  return new JFreeChart("String_Node_Str",null,plot,false);
}
Program: 26488
Project: 26488
Buggy source:
protected void formatChart(){
  super.formatChart();
  XYPlot plot=chart.getXYPlot();
  if (stacked) {
    StackedXYAreaRenderer2 renderer=(StackedXYAreaRenderer2)plot.getRenderer();
    renderer.setLegendArea(new java.awt.Rectangle(10,10));
    renderer.setBaseToolTipGenerator(tooltipGenerator);
  }
 else {
    StandardXYItemRenderer renderer=(StandardXYItemRenderer)plot.getRenderer(0);
    renderer.setBaseShapesVisible(true);
    renderer.setBaseShapesFilled(true);
    renderer.setPlotDiscontinuous(true);
    renderer.setGapThresholdType(UnitType.ABSOLUTE);
    recalculateGapThreshold(chart,0);
    renderer.setBaseToolTipGenerator(tooltipGenerator);
  }
  if (hasSecondaryYAxis) {
    StandardXYItemRenderer renderer=new StandardXYItemRenderer();
    plot.setRenderer(1,renderer);
    renderer.setBaseShapesVisible(true);
    renderer.setBaseShapesFilled(true);
    renderer.setPlotDiscontinuous(true);
    renderer.setGapThresholdType(UnitType.ABSOLUTE);
    recalculateGapThreshold(chart,1);
    renderer.setBaseToolTipGenerator(tooltipGenerator);
  }
  for (int i=0; i < plot.getRangeAxisCount(); i++) {
    plot.getRangeAxis(i).setLabelFont(LABEL_FONT);
    plot.getRangeAxis(i).setTickLabelFont(AXIS_FONT);
  }
  plot.getDomainAxis().setLabelFont(LABEL_FONT);
  plot.getDomainAxis().setTickLabelFont(AXIS_FONT);
  plot.setRangeGridlinePaint(GRID_COLOR);
  plot.setRangeGridlineStroke(GRID_LINES);
}

Fixed version (ground truth):
protected void formatChart(){
  super.formatChart();
  XYPlot plot=chart.getXYPlot();
  if (stacked) {
    StackedXYAreaRenderer2 renderer=(StackedXYAreaRenderer2)plot.getRenderer();
    renderer.setLegendArea(new java.awt.Rectangle(10,10));
    renderer.setBaseToolTipGenerator(tooltipGenerator);
  }
 else {
    StandardXYItemRenderer renderer=(StandardXYItemRenderer)plot.getRenderer(0);
    renderer.setBaseShapesVisible(true);
    renderer.setBaseShapesFilled(true);
    renderer.setPlotDiscontinuous(true);
    renderer.setGapThresholdType(UnitType.ABSOLUTE);
    recalculateGapThreshold(0);
    renderer.setBaseToolTipGenerator(tooltipGenerator);
  }
  if (hasSecondaryYAxis) {
    StandardXYItemRenderer renderer=(StandardXYItemRenderer)plot.getRenderer(1);
    renderer.setBaseShapesVisible(true);
    renderer.setBaseShapesFilled(true);
    renderer.setPlotDiscontinuous(true);
    renderer.setGapThresholdType(UnitType.ABSOLUTE);
    recalculateGapThreshold(1);
    renderer.setBaseToolTipGenerator(tooltipGenerator);
  }
  for (int i=0; i < plot.getRangeAxisCount(); i++) {
    plot.getRangeAxis(i).setLabelFont(LABEL_FONT);
    plot.getRangeAxis(i).setTickLabelFont(AXIS_FONT);
  }
  plot.getDomainAxis().setLabelFont(LABEL_FONT);
  plot.getDomainAxis().setTickLabelFont(AXIS_FONT);
  plot.setRangeGridlinePaint(GRID_COLOR);
  plot.setRangeGridlineStroke(GRID_LINES);
}
Program: 26489
Project: 26489
Buggy source:
private void recalculateGapThreshold(JFreeChart chart,int datasetIndex){
  if (stacked && (datasetIndex == 0)) {
    return;
  }
 else {
    XYPlot plot=chart.getXYPlot();
    if (plot.getDataset(datasetIndex).getItemCount(0) > 0) {
      DataTupleXYDataset dataset=(DataTupleXYDataset)plot.getDataset(datasetIndex);
      int seriesCount=dataset.getSeriesCount();
      double[] averageDistance=new double[seriesCount];
      int[] count=new int[seriesCount];
      double[] previousX=new double[seriesCount];
      java.util.Arrays.fill(averageDistance,0);
      java.util.Arrays.fill(count,0);
      java.util.Arrays.fill(previousX,dataset.getXValue(0,0));
      for (int i=1; i < dataset.getItemCount(0); i++) {
        double currentX=dataset.getXValue(0,i);
        for (int j=0; j < seriesCount; j++) {
          double y=dataset.getYValue(j,i);
          if (!Double.isNaN(y)) {
            averageDistance[j]+=currentX - previousX[j];
            previousX[j]=currentX;
            ++count[j];
          }
        }
      }
      double maxAverage=Double.MIN_VALUE;
      for (int i=0; i < seriesCount; i++) {
        averageDistance[i]/=count[i];
        if (averageDistance[i] > maxAverage) {
          maxAverage=averageDistance[i];
        }
      }
      ((StandardXYItemRenderer)plot.getRenderer(datasetIndex)).setGapThreshold(maxAverage * 1.25);
    }
 else {
      ((StandardXYItemRenderer)plot.getRenderer()).setGapThreshold(Integer.MAX_VALUE);
    }
  }
}

Fixed version (ground truth):
private void recalculateGapThreshold(int datasetIndex){
  if (stacked && (datasetIndex == 0)) {
    return;
  }
 else {
    XYPlot plot=chart.getXYPlot();
    if (plot.getDataset(datasetIndex).getItemCount(0) > 0) {
      DataTupleXYDataset dataset=(DataTupleXYDataset)plot.getDataset(datasetIndex);
      int seriesCount=dataset.getSeriesCount();
      double[] averageDistance=new double[seriesCount];
      int[] count=new int[seriesCount];
      double[] previousX=new double[seriesCount];
      java.util.Arrays.fill(averageDistance,0);
      java.util.Arrays.fill(count,0);
      java.util.Arrays.fill(previousX,dataset.getXValue(0,0));
      for (int i=1; i < dataset.getItemCount(0); i++) {
        double currentX=dataset.getXValue(0,i);
        for (int j=0; j < seriesCount; j++) {
          double y=dataset.getYValue(j,i);
          if (!Double.isNaN(y)) {
            averageDistance[j]+=currentX - previousX[j];
            previousX[j]=currentX;
            ++count[j];
          }
        }
      }
      double maxAverage=Double.MIN_VALUE;
      for (int i=0; i < seriesCount; i++) {
        averageDistance[i]/=count[i];
        if (averageDistance[i] > maxAverage) {
          maxAverage=averageDistance[i];
        }
      }
      ((StandardXYItemRenderer)plot.getRenderer(datasetIndex)).setGapThreshold(maxAverage * 1.25);
    }
 else {
      ((StandardXYItemRenderer)plot.getRenderer()).setGapThreshold(Integer.MAX_VALUE);
    }
  }
}