Program: 26480
Project: 26480
Buggy source:
public void addLine(IntervalChartDefinition lineDefinition,List<AnalysisRecord> records){
  if (chart == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  if ((records == null) || records.isEmpty()) {
    return;
  }
  if (records.size() > 4) {
    ((CategoryPlot)chart.getPlot()).getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.UP_45);
  }
  DataTupleCategoryDataset dataset=(DataTupleCategoryDataset)((CategoryPlot)chart.getPlot()).getDataset(lineDefinition.hasSecondaryYAxis() ? 1 : 0);
  DataSet data=records.get(0).getDataSet();
  Map<String,Integer> usedIntervalNames=new java.util.HashMap<String,Integer>(records.size());
  for (  DataDefinition definition : lineDefinition.getLines()) {
    if (definition.matchesHost(data)) {
      for (      DataType type : definition.getMatchingTypes(data)) {
        List<String> fields=definition.getMatchingFields(type);
        for (        String field : fields) {
          String name=lineDefinition.getLineNamingMode().getName(definition,data,type,field,granularity);
          for (          AnalysisRecord record : records) {
            double value=definition.getStatistic().getValue(record,type,field);
            String intervalName=record.getInterval().getName();
            if ("String_Node_Str".equals(intervalName)) {
              if (record.getInterval().getDuration() >= (86400 * 1000)) {
                intervalName=TimeFormatCache.formatDateTime(record.getInterval().getStart()) + '-' + TimeFormatCache.formatDateTime(record.getInterval().getEnd());
              }
 else {
                intervalName=TimeFormatCache.formatTime(record.getInterval().getStart()) + '-' + TimeFormatCache.formatTime(record.getInterval().getEnd());
              }
            }
            Integer count=usedIntervalNames.get(intervalName);
            if (count != null) {
              int i=dataset.getColumnIndex(name);
              if (i != -1) {
                usedIntervalNames.put(intervalName,++count);
                intervalName+="String_Node_Str" + count;
              }
            }
 else {
              usedIntervalNames.put(intervalName,0);
            }
            dataset.addValue(value,name,intervalName);
            dataset.associateTuple(name,intervalName,new DataTuple(record.getDataSet(),type,field));
          }
        }
      }
    }
  }
  if ((dataset.getRowCount() > 1) && (chart.getLegend() == null)) {
    addLegend();
  }
}

Fixed version (ground truth):
public void addLine(IntervalChartDefinition lineDefinition,List<AnalysisRecord> records){
  if (chart == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  if ((records == null) || records.isEmpty()) {
    return;
  }
  if (records.size() > 4) {
    ((CategoryPlot)chart.getPlot()).getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.UP_45);
  }
  DataTupleCategoryDataset dataset=(DataTupleCategoryDataset)((CategoryPlot)chart.getPlot()).getDataset(lineDefinition.hasSecondaryYAxis() ? 1 : 0);
  DataSet data=records.get(0).getDataSet();
  Map<String,Integer> usedIntervalNames=new java.util.HashMap<String,Integer>(records.size());
  for (  DataDefinition definition : lineDefinition.getLines()) {
    if (definition.matchesHost(data)) {
      for (      DataType type : definition.getMatchingTypes(data)) {
        List<String> fields=definition.getMatchingFields(type);
        for (        String field : fields) {
          String name=lineDefinition.getLineNamingMode().getName(definition,data,type,field,granularity);
          for (          AnalysisRecord record : records) {
            double value=definition.getStatistic().getValue(record,type,field);
            String intervalName=record.getInterval().getName();
            if ("String_Node_Str".equals(intervalName)) {
              if (record.getInterval().getDuration() >= (86400 * 1000)) {
                intervalName=TimeFormatCache.formatDateTime(record.getInterval().getStart()) + '-' + TimeFormatCache.formatDateTime(record.getInterval().getEnd());
              }
 else {
                intervalName=TimeFormatCache.formatTime(record.getInterval().getStart()) + '-' + TimeFormatCache.formatTime(record.getInterval().getEnd());
              }
            }
            Integer count=usedIntervalNames.get(intervalName);
            if (count != null) {
              int i=dataset.getColumnIndex(name);
              if (i != -1) {
                usedIntervalNames.put(intervalName,++count);
                intervalName+="String_Node_Str" + count;
              }
            }
 else {
              usedIntervalNames.put(intervalName,0);
            }
            dataset.addValue(value,name,intervalName);
            dataset.associateTuple(name,intervalName,new DataTuple(record.getDataSet(),type,field));
          }
        }
      }
    }
  }
  if (chart.getLegend() == null) {
    int rowCount=chart.getCategoryPlot().getDataset(0).getRowCount();
    if (hasSecondaryYAxis) {
      rowCount+=chart.getCategoryPlot().getDataset(1).getRowCount();
    }
    if (rowCount > 1) {
      addLegend();
    }
  }
}