nus-yam/ex-repair huggingface dataset:
Program: 131122
Project: 131122
Buggy source:
public JMenuBar getChartMenu(){
  mnuTop5.setActionCommand("String_Node_Str");
  mnuTop5.addActionListener(this);
  mnuTop10.setActionCommand("String_Node_Str");
  mnuTop10.addActionListener(this);
  JMenu menuTop=new JMenu("String_Node_Str");
  menuTop.add(mnuTop5);
  menuTop.add(mnuTop10);
  mnuPie.setActionCommand("String_Node_Str");
  mnuPie.addActionListener(this);
  mnuPie3d.setActionCommand("String_Node_Str");
  mnuPie3d.addActionListener(this);
  mnuBar.setActionCommand("String_Node_Str");
  mnuBar.addActionListener(this);
  mnuBar3d.setActionCommand("String_Node_Str");
  mnuBar3d.addActionListener(this);
  JMenu menuStyle=new JMenu("String_Node_Str");
  menuStyle.add(mnuPie);
  menuStyle.add(mnuPie3d);
  menuStyle.add(mnuBar);
  menuStyle.add(mnuBar3d);
  JMenu menuChart=new JMenu("String_Node_Str");
  menuChart.add(menuTop);
  menuChart.add(menuStyle);
  JMenuBar menuBar=new JMenuBar();
  menuBar.add(menuChart);
  return menuBar;
}

Fixed version (ground truth):
public JMenuBar getChartMenu(){
  mnuTop5.setActionCommand("String_Node_Str");
  mnuTop5.addActionListener(this);
  mnuTop10.setActionCommand("String_Node_Str");
  mnuTop10.addActionListener(this);
  ButtonGroup topGroup=new ButtonGroup();
  topGroup.add(mnuTop5);
  topGroup.add(mnuTop10);
  JMenu menuTop=new JMenu("String_Node_Str");
  menuTop.add(mnuTop5);
  menuTop.add(mnuTop10);
  mnuPie.setActionCommand("String_Node_Str");
  mnuPie.addActionListener(this);
  mnuPie3d.setActionCommand("String_Node_Str");
  mnuPie3d.addActionListener(this);
  mnuBar.setActionCommand("String_Node_Str");
  mnuBar.addActionListener(this);
  mnuBar3d.setActionCommand("String_Node_Str");
  mnuBar3d.addActionListener(this);
  ButtonGroup styleGroup=new ButtonGroup();
  styleGroup.add(mnuPie);
  styleGroup.add(mnuPie3d);
  styleGroup.add(mnuBar);
  styleGroup.add(mnuBar3d);
  JMenu menuStyle=new JMenu("String_Node_Str");
  menuStyle.add(mnuPie);
  menuStyle.add(mnuPie3d);
  menuStyle.add(mnuBar);
  menuStyle.add(mnuBar3d);
  JMenu menuChart=new JMenu("String_Node_Str");
  menuChart.add(menuTop);
  menuChart.add(menuStyle);
  JMenuBar menuBar=new JMenuBar();
  menuBar.add(menuChart);
  return menuBar;
}
Program: 131123
Project: 131123
Buggy source:
private void updatePanel(int top){
  boolean chart3d=false;
  if (mnuPie3d.getState() || mnuBar3d.getState()) {
    chart3d=true;
  }
  chartData.setTop(top);
  updateChartEvents(chart3d);
  reloadTable();
  updateTextArea();
}

Fixed version (ground truth):
private void updatePanel(int top){
  boolean chart3d=false;
  if (mnuPie3d.isSelected() || mnuBar3d.isSelected()) {
    chart3d=true;
  }
  chartData.setTop(top);
  updateChartEvents(chartData.getChartStyle(),chart3d);
  reloadTable();
  updateTextArea();
}
Program: 131124
Project: 131124
Buggy source:
@Override public void actionPerformed(ActionEvent e){
  String actionCommand=e.getActionCommand();
switch (actionCommand) {
case "String_Node_Str":
    mnuTop5.setState(true);
  mnuTop10.setState(false);
updatePanel(5);
break;
case "String_Node_Str":
mnuTop5.setState(false);
mnuTop10.setState(true);
updatePanel(10);
break;
case "String_Node_Str":
mnuPie.setState(true);
mnuBar.setState(false);
mnuPie3d.setState(false);
mnuBar3d.setState(false);
chartData.setChartStyle("String_Node_Str");
updateChartEvents(false);
break;
case "String_Node_Str":
mnuPie.setState(false);
mnuBar.setState(true);
mnuPie3d.setState(false);
mnuBar3d.setState(false);
chartData.setChartStyle("String_Node_Str");
updateChartEvents(false);
break;
case "String_Node_Str":
mnuPie.setState(false);
mnuBar.setState(false);
mnuPie3d.setState(true);
mnuBar3d.setState(false);
chartData.setChartStyle("String_Node_Str");
updateChartEvents(true);
break;
case "String_Node_Str":
mnuPie.setState(false);
mnuBar.setState(false);
mnuPie3d.setState(false);
mnuBar3d.setState(true);
chartData.setChartStyle("String_Node_Str");
updateChartEvents(true);
break;
}
}

Fixed version (ground truth):
@Override public void actionPerformed(ActionEvent e){
  String actionCommand=e.getActionCommand();
switch (actionCommand) {
case "String_Node_Str":
    updatePanel(5);
  break;
case "String_Node_Str":
updatePanel(10);
break;
case "String_Node_Str":
updateChartEvents("String_Node_Str",false);
break;
case "String_Node_Str":
;
updateChartEvents("String_Node_Str",false);
break;
case "String_Node_Str":
updateChartEvents("String_Node_Str",true);
break;
case "String_Node_Str":
updateChartEvents("String_Node_Str",true);
break;
}
}
Program: 131125
Project: 131125
Buggy source:
public static String getEventProperty(String property,Event event){
  String requiredValue=null;
  if (property.indexOf("String_Node_Str") > 1) {
    String[] parts=property.split(Pattern.quote("String_Node_Str"));
    Object subClassObj=callMethod(parts[0],event);
    if (parts[0].equalsIgnoreCase("String_Node_Str")) {
      UserIdentity userIdentity=(UserIdentity)subClassObj;
      requiredValue=(String)callMethod(parts[1],userIdentity);
    }
  }
 else {
    requiredValue=(String)callMethod(property,event);
  }
  return requiredValue;
}

Fixed version (ground truth):
public static String getEventProperty(String property,Object event){
  String requiredValue;
  if (property.contains("String_Node_Str")) {
    int pos=property.indexOf("String_Node_Str");
    String field=property.substring(0,pos);
    Object subClass=callMethod(field,event);
    if (subClass != null) {
      property=property.substring(pos + 1);
      return getEventProperty(property,subClass);
    }
 else {
      return null;
    }
  }
 else {
    requiredValue=(String)callMethod(property,event);
  }
  return requiredValue;
}
Program: 131126
Project: 131126
Buggy source:
private void buildUI(){
  this.setSize(jCloudTrailViewer.DESKTOP.getWidth() - 50,jCloudTrailViewer.DESKTOP.getHeight() - 50);
  JPanel sidePanel=new JPanel();
  sidePanel.setLayout(new BoxLayout(sidePanel,BoxLayout.Y_AXIS));
  sidePanel.add(triPanel);
  this.setJMenuBar(triPanel.getChartMenu());
  sidePanel.add(getEventDetailPanel());
  JPanel mainPanel=new JPanel();
  mainPanel.setLayout(new BorderLayout());
  createTpsChart();
  mainPanel.add(tpsPanel,BorderLayout.NORTH);
  final EventsTable table=new EventsTable(eventsTableModel);
  table.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
    @Override public void valueChanged(    ListSelectionEvent e){
      if (e.getFirstIndex() >= 0) {
        Event event=eventsTableModel.getEventAt(table.getSelectedRow());
        showEventDetail(event);
      }
    }
  }
);
  table.setSize(new Dimension(400,205));
  table.setVisible(true);
  JScrollPane eventsScrollPane=new JScrollPane(table);
  mainPanel.add(eventsScrollPane,BorderLayout.CENTER);
  JSplitPane split=new JSplitPane();
  split.add(mainPanel,JSplitPane.LEFT);
  split.add(sidePanel,JSplitPane.RIGHT);
  split.setOneTouchExpandable(true);
  split.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
  split.setDividerSize(10);
  split.setAutoscrolls(false);
  split.setDividerLocation(this.getWidth() - 300);
  split.setResizeWeight(1.0);
  this.add(split,BorderLayout.CENTER);
  this.validate();
}

Fixed version (ground truth):
private void buildUI(){
  this.setSize(jCloudTrailViewer.DESKTOP.getWidth() - 50,jCloudTrailViewer.DESKTOP.getHeight() - 50);
  JPanel sidePanel=new JPanel();
  sidePanel.setLayout(new BoxLayout(sidePanel,BoxLayout.Y_AXIS));
  sidePanel.add(triPanel);
  sidePanel.add(getEventDetailPanel());
  JPanel mainPanel=new JPanel();
  mainPanel.setLayout(new BorderLayout());
  createTpsChart();
  mainPanel.add(tpsPanel,BorderLayout.NORTH);
  final EventsTable table=new EventsTable(eventsTableModel);
  table.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
    @Override public void valueChanged(    ListSelectionEvent e){
      if (e.getFirstIndex() >= 0) {
        Event event=eventsTableModel.getEventAt(table.getSelectedRow());
        showEventDetail(event);
      }
    }
  }
);
  table.setSize(new Dimension(400,205));
  table.setVisible(true);
  JScrollPane eventsScrollPane=new JScrollPane(table);
  mainPanel.add(eventsScrollPane,BorderLayout.CENTER);
  JSplitPane split=new JSplitPane();
  split.add(mainPanel,JSplitPane.LEFT);
  split.add(sidePanel,JSplitPane.RIGHT);
  split.setOneTouchExpandable(true);
  split.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
  split.setDividerSize(10);
  split.setAutoscrolls(false);
  split.setDividerLocation(this.getWidth() - 300);
  split.setResizeWeight(1.0);
  this.add(split,BorderLayout.CENTER);
  this.validate();
}
Program: 131128
Project: 131128
Buggy source:
private void loadFromS3Files(final List<String> keys){
  if (keys != null && keys.size() > 0) {
    AWSCredentials credentials=new BasicAWSCredentials(PropertiesSingleton.getInstance().getProperty("String_Node_Str"),PropertiesSingleton.getInstance().getProperty("String_Node_Str"));
    AmazonS3 s3Client=new AmazonS3Client(credentials);
    String bucketName=PropertiesSingleton.getInstance().getProperty("String_Node_Str");
    int numFiles=keys.size();
    int count=0;
    for (    String key : keys) {
      count++;
      try {
        postMessage("String_Node_Str" + count + "String_Node_Str"+ numFiles);
        readS3File(s3Client,bucketName,key);
      }
 catch (      IOException ex) {
        Logger.getLogger(EventLoader.class.getName()).log(Level.SEVERE,null,ex);
      }
    }
    for (    EventLoaderListener l : listeners) {
      l.finishedLoading();
    }
    postMessage("String_Node_Str");
  }
}

Fixed version (ground truth):
private void loadFromS3Files(final List<String> keys){
  if (keys != null && keys.size() > 0) {
    AWSCredentials credentials=new BasicAWSCredentials(PropertiesSingleton.getInstance().getProperty("String_Node_Str"),PropertiesSingleton.getInstance().getProperty("String_Node_Str"));
    AmazonS3 s3Client=new AmazonS3Client(credentials);
    String bucketName=PropertiesSingleton.getInstance().getProperty("String_Node_Str");
    int numFiles=keys.size();
    int count=0;
    for (    String key : keys) {
      count++;
      try {
        postMessage("String_Node_Str" + count + "String_Node_Str"+ numFiles);
        readS3File(s3Client,bucketName,key);
      }
 catch (      Exception ex) {
        Logger.getLogger(EventLoader.class.getName()).log(Level.SEVERE,null,ex);
      }
    }
    for (    EventLoaderListener l : listeners) {
      l.finishedLoading();
    }
    postMessage("String_Node_Str");
  }
}
Program: 131129
Project: 131129
Buggy source:
protected void addTabbedChartDetail(int width,int height){
  createChart(width,height);
  if (chartPanel != null) {
    tabs.addTab("String_Node_Str",chartPanel);
  }
  JTable table=new JTable(defaultTableModel);
  table.setPreferredSize(new Dimension(480,260));
  reloadTable();
  tabs.addTab("String_Node_Str",table);
  updateTextArea();
  tabs.addTab("String_Node_Str",eventDetailTextArea);
}

Fixed version (ground truth):
protected void addTabbedChartDetail(int width,int height){
  createChart(width,height);
  if (chartPanel != null) {
    tabs.addTab("String_Node_Str",chartPanel);
  }
  JTable table=new JTable(defaultTableModel);
  JScrollPane tablecrollPane=new JScrollPane(table);
  table.setPreferredSize(new Dimension(480,260));
  reloadTable();
  tabs.addTab("String_Node_Str",tablecrollPane);
  updateTextArea();
  JScrollPane tabbedDataScrollPane=new JScrollPane(tabbedTextArea);
  tabs.addTab("String_Node_Str",tabbedDataScrollPane);
}
Program: 131130
Project: 131130
Buggy source:
public AbstractInternalFrame(String title){
  super(title,true,true,false,true);
  this.setLayout(new BorderLayout());
  eventDetailTextArea.setFont(new Font("String_Node_Str",Font.PLAIN,10));
  chartData.setChartStyle("String_Node_Str");
  chartData.setTop(5);
  defaultTableModel.addColumn("String_Node_Str");
  defaultTableModel.addColumn("String_Node_Str");
}

Fixed version (ground truth):
public AbstractInternalFrame(String title){
  super(title,true,true,false,true);
  this.setLayout(new BorderLayout());
  eventDetailTextArea.setFont(new Font("String_Node_Str",Font.PLAIN,10));
  tabbedTextArea.setFont(new Font("String_Node_Str",Font.PLAIN,10));
  chartData.setChartStyle("String_Node_Str");
  chartData.setTop(5);
  defaultTableModel.addColumn("String_Node_Str");
  defaultTableModel.addColumn("String_Node_Str");
}
Program: 131131
Project: 131131
Buggy source:
@Override protected void updateTextArea(){
  if (events != null) {
    StringBuilder dataString=new StringBuilder();
    for (    Map.Entry entry : chartEvents) {
      dataString.append(entry.getKey()).append("String_Node_Str").append(entry.getValue()).append(NEWLINE);
    }
    eventDetailTextArea.setText(dataString.toString());
  }
}

Fixed version (ground truth):
@Override protected void updateTextArea(){
  if (events != null) {
    StringBuilder dataString=new StringBuilder();
    for (    Map.Entry entry : chartEvents) {
      dataString.append(entry.getKey()).append("String_Node_Str").append(entry.getValue()).append(NEWLINE);
    }
    tabbedTextArea.setText(dataString.toString());
  }
}
Program: 131132
Project: 131132
Buggy source:
@Override protected void updateTextArea(){
  if (chartEvents != null) {
    int count=0;
    StringBuilder dataString=new StringBuilder();
    for (    Map.Entry entry : chartEvents) {
      if (count >= chartData.getTop()) {
        break;
      }
      dataString.append(entry.getKey()).append("String_Node_Str").append(entry.getValue()).append(NEWLINE);
      count++;
    }
    eventDetailTextArea.setText(dataString.toString());
  }
}

Fixed version (ground truth):
@Override protected void updateTextArea(){
  if (chartEvents != null) {
    int count=0;
    StringBuilder dataString=new StringBuilder();
    for (    Map.Entry entry : chartEvents) {
      if (count >= chartData.getTop()) {
        break;
      }
      dataString.append(entry.getKey()).append("String_Node_Str").append(entry.getValue()).append(NEWLINE);
      count++;
    }
    tabbedTextArea.setText(dataString.toString());
  }
}
Program: 131133
Project: 131133
Buggy source:
@Override protected void updateTextArea(){
  if (chartEvents != null) {
    int count=0;
    StringBuilder dataString=new StringBuilder();
    for (    Map.Entry entry : chartEvents) {
      if (count >= chartData.getTop()) {
        break;
      }
      dataString.append(entry.getKey()).append("String_Node_Str").append(entry.getValue()).append(NEWLINE);
      count++;
    }
    eventDetailTextArea.setText(dataString.toString());
  }
}

Fixed version (ground truth):
@Override protected void updateTextArea(){
  if (chartEvents != null) {
    int count=0;
    StringBuilder dataString=new StringBuilder();
    for (    Map.Entry entry : chartEvents) {
      if (count >= chartData.getTop()) {
        break;
      }
      dataString.append(entry.getKey()).append("String_Node_Str").append(entry.getValue()).append(NEWLINE);
      count++;
    }
    tabbedTextArea.setText(dataString.toString());
  }
}
Program: 131134
Project: 131134
Buggy source:
private void showEventsByServiceChart(){
  ChartData chartData=new ChartData();
  chartData.setChartStyle("String_Node_Str");
  chartData.setChartSource("String_Node_Str");
  List<Map.Entry<String,Integer>> events=EventUtils.entriesSortedByValues(eventsDatabase.getEventsPerService());
  ChartWindow chart=new ChartWindow(chartData,events);
  chart.setVisible(true);
  jCloudTrailViewer.DESKTOP.add(chart);
  try {
    chart.setSelected(true);
  }
 catch (  java.beans.PropertyVetoException pve) {
  }
}

Fixed version (ground truth):
private void showEventsByServiceChart(){
  if (eventsDatabase.getEventsPerService().size() > 0) {
    ChartData chartData=new ChartData();
    chartData.setChartStyle("String_Node_Str");
    chartData.setChartSource("String_Node_Str");
    List<Map.Entry<String,Integer>> events=EventUtils.entriesSortedByValues(eventsDatabase.getEventsPerService());
    ChartWindow chart=new ChartWindow(chartData,events);
    chart.setVisible(true);
    jCloudTrailViewer.DESKTOP.add(chart);
    try {
      chart.setSelected(true);
    }
 catch (    java.beans.PropertyVetoException pve) {
    }
  }
 else {
    JOptionPane.showMessageDialog(jCloudTrailViewer.DESKTOP,"String_Node_Str","String_Node_Str",JOptionPane.WARNING_MESSAGE);
  }
}
Program: 131135
Project: 131135
Buggy source:
@Override public void chartMouseClicked(ChartMouseEvent cme){
  if (cme.getTrigger().getClickCount() == 2) {
    Object object=cme.getEntity();
    ChartEntity cie=(ChartEntity)object;
    if (chartData.getChartStyle().equalsIgnoreCase("String_Node_Str")) {
      PieSectionEntity categoryItemEntity=(PieSectionEntity)cie;
      chartSelect=categoryItemEntity.getSectionKey().toString();
    }
 else     if (chartData.getChartStyle().equalsIgnoreCase("String_Node_Str")) {
      CategoryItemEntity categoryItemEntity=(CategoryItemEntity)cie;
      chartSelect=categoryItemEntity.getCategory().toString();
    }
    if (chartSelect != null) {
      filters.setFilterCriteria(chartSelect);
      List<Event> filteredEvents=filters.filterEvents(events);
      TableWindow window=new TableWindow("String_Node_Str" + chartSelect,filteredEvents);
      window.setVisible(true);
      jCloudTrailViewer.DESKTOP.add(window);
      try {
        window.setSelected(true);
      }
 catch (      java.beans.PropertyVetoException pve) {
      }
    }
  }
}

Fixed version (ground truth):
@Override public void chartMouseClicked(ChartMouseEvent cme){
  if (cme.getTrigger().getClickCount() == 2) {
    Object object=cme.getEntity();
    ChartEntity cie=(ChartEntity)object;
    if (chartData.getChartStyle().equalsIgnoreCase("String_Node_Str")) {
      PieSectionEntity categoryItemEntity=(PieSectionEntity)cie;
      chartSelect=categoryItemEntity.getSectionKey().toString();
    }
 else     if (chartData.getChartStyle().equalsIgnoreCase("String_Node_Str")) {
      CategoryItemEntity categoryItemEntity=(CategoryItemEntity)cie;
      chartSelect=categoryItemEntity.getCategory().toString();
    }
    if (chartSelect != null && events != null) {
      filters.setFilterCriteria(chartSelect);
      List<Event> filteredEvents=filters.filterEvents(events);
      TableWindow window=new TableWindow("String_Node_Str" + chartSelect,filteredEvents);
      window.setVisible(true);
      jCloudTrailViewer.DESKTOP.add(window);
      try {
        window.setSelected(true);
      }
 catch (      java.beans.PropertyVetoException pve) {
      }
    }
  }
}
Program: 131136
Project: 131136
Buggy source:
protected void addTabbedChartDetail(int width,int height){
  createChart(width,height);
  if (chartPanel != null) {
    tabs.addTab("String_Node_Str",chartPanel);
  }
  JTable table=new JTable(defaultTableModel);
  JScrollPane tablecrollPane=new JScrollPane(table);
  table.setPreferredSize(new Dimension(480,260));
  reloadTable();
  tabs.addTab("String_Node_Str",tablecrollPane);
  updateTextArea();
  JScrollPane tabbedDataScrollPane=new JScrollPane(tabbedTextArea);
  tabs.addTab("String_Node_Str",tabbedDataScrollPane);
}

Fixed version (ground truth):
protected void addTabbedChartDetail(int width,int height){
  createChart(width,height);
  if (chartPanel != null) {
    tabs.addTab("String_Node_Str",chartPanel);
  }
  JTable table=new JTable(defaultTableModel);
  JScrollPane tablecrollPane=new JScrollPane(table);
  reloadTable();
  tabs.addTab("String_Node_Str",tablecrollPane);
  updateTextArea();
  JScrollPane tabbedDataScrollPane=new JScrollPane(tabbedTextArea);
  tabs.addTab("String_Node_Str",tabbedDataScrollPane);
}
Program: 131137
Project: 131137
Buggy source:
protected void reloadTable(){
  for (int i=defaultTableModel.getRowCount() - 1; i >= 0; i--) {
    defaultTableModel.removeRow(i);
  }
  if (events != null && events.size() > 0) {
    for (    Entry entry : chartEvents) {
      defaultTableModel.addRow(new Object[]{entry.getKey(),entry.getValue()});
    }
  }
 else   if (eventMap.size() > 0) {
    Set<Entry<String,Integer>> entries=eventMap.entrySet();
    Iterator<Entry<String,Integer>> entriesIt=entries.iterator();
    while (entriesIt.hasNext()) {
      Entry entry=entriesIt.next();
      defaultTableModel.addRow(new Object[]{entry.getKey(),entry.getValue()});
    }
  }
}

Fixed version (ground truth):
protected void reloadTable(){
  for (int i=defaultTableModel.getRowCount() - 1; i >= 0; i--) {
    defaultTableModel.removeRow(i);
  }
  if (chartEvents != null && chartEvents.size() > 0) {
    for (    Entry entry : chartEvents) {
      defaultTableModel.addRow(new Object[]{entry.getKey(),entry.getValue()});
    }
  }
}
Program: 131138
Project: 131138
Buggy source:
@Override public void newEvents(List<Event> events){
}

Fixed version (ground truth):
@Override public void newEvents(List<Event> newEvents){
}
Program: 131139
Project: 131139
Buggy source:
private void tpsPerService(List<Event> events){
  for (  Event event : events) {
    String eventName=event.getEventName();
    if (inTopX(event)) {
      int tpsCount=1;
      String dateTime=event.getEventTime();
      if (tpsMap.containsKey(eventName)) {
        Map<String,Integer> serviceTps=tpsMap.get(eventName);
        if (serviceTps.containsKey(dateTime)) {
          tpsCount=serviceTps.get(dateTime);
          tpsCount++;
          serviceTps.put(dateTime,tpsCount);
          tpsMap.put(eventName,serviceTps);
        }
 else {
          serviceTps.put(dateTime,tpsCount);
          tpsMap.put(eventName,serviceTps);
        }
      }
 else {
        Map<String,Integer> serviceTps=new HashMap<>();
        serviceTps.put(dateTime,tpsCount);
        tpsMap.put(eventName,serviceTps);
      }
    }
  }
}

Fixed version (ground truth):
private void tpsPerService(List<Event> eventsData){
  for (  Event event : eventsData) {
    String eventName=event.getEventName();
    if (inTopX(event)) {
      int tpsCount=1;
      String dateTime=event.getEventTime();
      if (tpsMap.containsKey(eventName)) {
        Map<String,Integer> serviceTps=tpsMap.get(eventName);
        if (serviceTps.containsKey(dateTime)) {
          tpsCount=serviceTps.get(dateTime);
          tpsCount++;
          serviceTps.put(dateTime,tpsCount);
          tpsMap.put(eventName,serviceTps);
        }
 else {
          serviceTps.put(dateTime,tpsCount);
          tpsMap.put(eventName,serviceTps);
        }
      }
 else {
        Map<String,Integer> serviceTps=new HashMap<>();
        serviceTps.put(dateTime,tpsCount);
        tpsMap.put(eventName,serviceTps);
      }
    }
  }
}
Program: 131140
Project: 131140
Buggy source:
public CombinedPanel(String title,List<Event> events,MenuDefinition menuDefinition){
  super(title);
  if (events != null) {
    generateData(events);
    buildUI();
  }
 else {
    if (menuDefinition.getActions() != null) {
      scanActions=menuDefinition.getActions();
    }
    if (menuDefinition.getContains() != null) {
      EventFilter filter=null;
      if (menuDefinition.getContains().contains("String_Node_Str")) {
        String[] parts=menuDefinition.getContains().split("String_Node_Str");
        String filterName=parts[0];
        try {
          Class c=Class.forName("String_Node_Str" + filterName);
          filter=(EventFilter)c.newInstance();
        }
 catch (        ClassNotFoundException|InstantiationException|IllegalAccessException ex) {
          Logger.getLogger(ScanTablePanel.class.getName()).log(Level.SEVERE,null,ex);
        }
        scanNeedle=parts[1];
      }
 else {
        filter=new FreeformFilter();
        scanNeedle=menuDefinition.getContains();
      }
      if (filter != null) {
        filters.addEventFilter(filter);
      }
    }
    eventLoader.addListener(this);
    int scanDialogResult=showScanDialog();
    if (scanDialogResult == 0) {
      eventLoader.showFileBrowser();
    }
 else     if (scanDialogResult == 1) {
      eventLoader.showS3Browser();
    }
 else {
      this.dispose();
    }
  }
}

Fixed version (ground truth):
public CombinedPanel(String title,List<Event> logEvents,MenuDefinition menuDefinition){
  super(title);
  if (logEvents != null) {
    events=logEvents;
    generateData(logEvents);
    buildUI();
  }
 else {
    if (menuDefinition.getActions() != null) {
      scanActions=menuDefinition.getActions();
    }
    if (menuDefinition.getContains() != null) {
      EventFilter filter=null;
      if (menuDefinition.getContains().contains("String_Node_Str")) {
        String[] parts=menuDefinition.getContains().split("String_Node_Str");
        String filterName=parts[0];
        try {
          Class c=Class.forName("String_Node_Str" + filterName);
          filter=(EventFilter)c.newInstance();
        }
 catch (        ClassNotFoundException|InstantiationException|IllegalAccessException ex) {
          Logger.getLogger(ScanTablePanel.class.getName()).log(Level.SEVERE,null,ex);
        }
        scanNeedle=parts[1];
      }
 else {
        filter=new FreeformFilter();
        scanNeedle=menuDefinition.getContains();
      }
      if (filter != null) {
        filters.addEventFilter(filter);
      }
    }
    eventLoader.addListener(this);
    int scanDialogResult=showScanDialog();
    if (scanDialogResult == 0) {
      eventLoader.showFileBrowser();
    }
 else     if (scanDialogResult == 1) {
      eventLoader.showS3Browser();
    }
 else {
      this.dispose();
    }
  }
}
Program: 131141
Project: 131141
Buggy source:
private void generateData(List<Event> events){
  chartData.setChartSource("String_Node_Str");
  chartData.setTop(5);
  chartData.setChartStyle("String_Node_Str");
  chartData.setChartType("String_Node_Str");
  chartEvents=EventUtils.getRequiredEvents(events,chartData);
  tpsPerService(events);
  eventsTableModel.setData(events);
}

Fixed version (ground truth):
private void generateData(List<Event> eventsData){
  chartData.setChartSource("String_Node_Str");
  chartData.setTop(5);
  chartData.setChartStyle("String_Node_Str");
  chartData.setChartType("String_Node_Str");
  generateInitialChartData();
  tpsPerService(eventsData);
  eventsTableModel.setData(eventsData);
}
Program: 131142
Project: 131142
Buggy source:
@Override public void finishedLoading(){
  chartEvents=EventUtils.entriesSortedByValues(eventMap);
  addTabbedChartDetail(480,160);
  this.validate();
}

Fixed version (ground truth):
@Override public void finishedLoading(){
  generateInitialChartData();
  addTabbedChartDetail(480,160);
  this.validate();
}
Program: 131143
Project: 131143
Buggy source:
@Override public void newEvents(List<Event> scannedEvents){
  for (  Event event : scannedEvents) {
    String value=EventUtils.getEventProperty(menuDefinition.getProperty(),event);
    if (value != null) {
      int count=1;
      if (eventMap.containsKey(value)) {
        count=eventMap.get(value) + 1;
      }
      eventMap.put(value,count);
    }
  }
}

Fixed version (ground truth):
@Override public void newEvents(List<Event> newEvents){
  for (  Event event : newEvents) {
    String value=EventUtils.getEventProperty(chartData.getChartSource(),event);
    if (value != null) {
      events.add(event);
    }
  }
}
Program: 131144
Project: 131144
Buggy source:
public ScanChartPanel(MenuDefinition menuDef){
  super(menuDef.getName());
  menuDefinition=menuDef;
  eventLoader.addListener(this);
  int scanDialogResult=showScanDialog();
  if (scanDialogResult == 0) {
    eventLoader.showFileBrowser();
    buildUI();
  }
 else   if (scanDialogResult == 1) {
    eventLoader.showS3Browser();
    buildUI();
  }
 else {
    this.dispose();
  }
}

Fixed version (ground truth):
public ScanChartPanel(MenuDefinition menuDef){
  super(menuDef.getName());
  chartData.setChartSource(menuDef.getProperty());
  eventLoader.addListener(this);
  int scanDialogResult=showScanDialog();
  if (scanDialogResult == 0) {
    eventLoader.showFileBrowser();
    buildUI();
  }
 else   if (scanDialogResult == 1) {
    eventLoader.showS3Browser();
    buildUI();
  }
 else {
    this.dispose();
  }
}
Program: 131145
Project: 131145
Buggy source:
public ChartWindow(ChartData chartData,List data){
  super(chartData.getChartSource());
  triPanel=new TriDataPanel(chartData);
  Object firstDataElement=data.get(0);
  if (firstDataElement instanceof Event) {
    events=data;
    chartEvents=null;
  }
 else {
    events=null;
    chartEvents=data;
  }
  filters.addEventFilter(new FreeformFilter());
  buildGui();
  if ((events != null && !events.isEmpty()) || (chartEvents != null && !chartEvents.isEmpty())) {
    triPanel.setEvents(events);
  }
 else {
    this.add(new JLabel("String_Node_Str"),BorderLayout.CENTER);
  }
}

Fixed version (ground truth):
public ChartWindow(ChartData chartData,List data){
  super(chartData.getChartSource());
  triPanel=new TriDataPanel(chartData);
  events=data;
  filters.addEventFilter(new FreeformFilter());
  buildGui();
  if (events != null && !events.isEmpty()) {
    triPanel.setEvents(events);
  }
 else {
    this.add(new JLabel("String_Node_Str"),BorderLayout.CENTER);
  }
}
Program: 131147
Project: 131147
Buggy source:
@Override public void actionPerformed(ActionEvent e){
  List<Event> events=null;
  int tabId=tabs.getSelectedIndex();
switch (tabId) {
case 0:
    events=errorTableModel.getEvents();
  break;
case 1:
events=iamTableModel.getEvents();
break;
case 2:
events=securityTableModel.getEvents();
break;
}
if (events != null) {
ChartData chartData=ChartDialog.showDialog(jCloudTrailViewer.DESKTOP);
if (chartData != null) {
List<Map.Entry<String,Integer>> chartMetrics=eventUtils.getRequiredEvents(events,chartData);
ChartWindow chart=new ChartWindow(chartData,chartMetrics);
chart.setVisible(true);
jCloudTrailViewer.DESKTOP.add(chart);
try {
chart.setSelected(true);
}
 catch (java.beans.PropertyVetoException pve) {
}
}
}
}

Fixed version (ground truth):
@Override public void actionPerformed(ActionEvent e){
  List<Event> events=null;
  int tabId=tabs.getSelectedIndex();
switch (tabId) {
case 0:
    events=errorTableModel.getEvents();
  break;
case 1:
events=iamTableModel.getEvents();
break;
case 2:
events=securityTableModel.getEvents();
break;
}
if (events != null) {
ChartData chartData=ChartDialog.showDialog(jCloudTrailViewer.DESKTOP);
if (chartData != null) {
ChartWindow chart=new ChartWindow(chartData,events);
chart.setVisible(true);
jCloudTrailViewer.DESKTOP.add(chart);
try {
chart.setSelected(true);
}
 catch (java.beans.PropertyVetoException pve) {
}
}
}
}
Program: 131148
Project: 131148
Buggy source:
protected void fillDebugInfo(Element element,Node node){
  if (!context.isDebug())   return;
  Token token=sourceMiner.findToken(node);
  int lineNumber=token.getLine();
  String sourceFile=context.getSourcePath() != null ? context.getSourcePath() : null;
  MDDExtensionUtils.addDebugInfo(element,sourceFile,lineNumber);
}

Fixed version (ground truth):
protected void fillDebugInfo(Element element,Node node){
  if (!context.isDebug())   return;
  Token token=null;
  while (token == null && node != null) {
    token=sourceMiner.findToken(node);
    node=node.parent();
  }
  if (token == null)   return;
  int lineNumber=token.getLine();
  String sourceFile=context.getSourcePath() != null ? context.getSourcePath() : null;
  MDDExtensionUtils.addDebugInfo(element,sourceFile,lineNumber);
}
Program: 131150
Project: 131150
Buggy source:
/** 
 * @param rgbRColor
 * @param rgbGColor
 * @param rgbBColor
 * @param rgbOpacity
 * @return
 */
public static String getColorMessage(float rgbRColor,float rgbGColor,float rgbBColor,float rgbOpacity){
  StringBuilder message=new StringBuilder();
  message.append("String_Node_Str");
  message.append(System.getProperty("String_Node_Str"));
  message.append("String_Node_Str");
  message.append("String_Node_Str" + UColor.getRGB(rgbRColor));
  message.append("String_Node_Str" + UColor.getRGB(rgbGColor));
  message.append("String_Node_Str" + UColor.getRGB(rgbBColor));
  message.append(System.getProperty("String_Node_Str"));
  message.append("String_Node_Str" + UColor.getRGB(rgbOpacity));
  message.append(System.getProperty("String_Node_Str"));
  message.append("String_Node_Str");
  float[] hsb=UColor.RGBToHSB(rgbRColor,rgbGColor,rgbBColor);
  message.append("String_Node_Str" + String.format("String_Node_Str",hsb[0]));
  message.append("String_Node_Str" + String.format("String_Node_Str",(hsb[1] * 100.0f)));
  message.append("String_Node_Str" + String.format("String_Node_Str",(hsb[2] * 100.0f)));
  message.append(System.getProperty("String_Node_Str"));
  message.append("String_Node_Str" + String.format("String_Node_Str",UColor.RGBToHex(rgbOpacity),UColor.RGBToHex(rgbRColor),UColor.RGBToHex(rgbGColor),UColor.RGBToHex(rgbBColor)));
  message.append(System.getProperty("String_Node_Str"));
  return message.toString();
}

Fixed version (ground truth):
/** 
 * @param rgbRColor
 * @param rgbGColor
 * @param rgbBColor
 * @param rgbOpacity
 * @return
 */
public static String getColorMessage(float rgbRColor,float rgbGColor,float rgbBColor,float rgbOpacity){
  StringBuilder message=new StringBuilder();
  message.append("String_Node_Str");
  message.append(System.getProperty("String_Node_Str"));
  message.append("String_Node_Str");
  message.append("String_Node_Str");
  message.append(UColor.getRGB(rgbRColor));
  message.append("String_Node_Str");
  message.append(UColor.getRGB(rgbGColor));
  message.append("String_Node_Str");
  message.append(UColor.getRGB(rgbBColor));
  message.append(System.getProperty("String_Node_Str"));
  message.append("String_Node_Str");
  message.append(UColor.getRGB(rgbOpacity));
  message.append(System.getProperty("String_Node_Str"));
  message.append("String_Node_Str");
  float[] hsb=UColor.RGBToHSB(rgbRColor,rgbGColor,rgbBColor);
  message.append("String_Node_Str");
  message.append(String.format("String_Node_Str",hsb[0]));
  message.append("String_Node_Str");
  message.append(String.format("String_Node_Str",(hsb[1] * 100.0f)));
  message.append("String_Node_Str");
  message.append(String.format("String_Node_Str",(hsb[2] * 100.0f)));
  message.append(System.getProperty("String_Node_Str"));
  message.append("String_Node_Str");
  message.append(String.format("String_Node_Str",UColor.RGBToHex(rgbOpacity),UColor.RGBToHex(rgbRColor),UColor.RGBToHex(rgbGColor),UColor.RGBToHex(rgbBColor)));
  message.append(System.getProperty("String_Node_Str"));
  return message.toString();
}
Program: 131151
Project: 131151
Buggy source:
public static String getPaletteMessage(Context context,String filename,ArrayList<PaletteSwatch> swatches){
  StringBuilder message=new StringBuilder();
  message.append("String_Node_Str");
  message.append(System.getProperty("String_Node_Str"));
  if (!"String_Node_Str".equals(filename)) {
    message.append("String_Node_Str" + filename);
    message.append(System.getProperty("String_Node_Str"));
  }
  for (  PaletteSwatch swatch : swatches) {
    message.append(UPalette.getSwatchDescription(context,swatch.getType()));
    message.append("String_Node_Str");
    message.append("String_Node_Str");
    message.append("String_Node_Str" + Integer.toHexString(swatch.getRgb()).toUpperCase());
    message.append(System.getProperty("String_Node_Str"));
  }
  return message.toString();
}

Fixed version (ground truth):
public static String getPaletteMessage(Context context,String filename,ArrayList<PaletteSwatch> swatches){
  StringBuilder message=new StringBuilder();
  message.append("String_Node_Str");
  message.append(System.getProperty("String_Node_Str"));
  if (!"String_Node_Str".equals(filename)) {
    message.append("String_Node_Str");
    message.append(filename);
    message.append(System.getProperty("String_Node_Str"));
  }
  for (  PaletteSwatch swatch : swatches) {
    message.append(UPalette.getSwatchDescription(context,swatch.getType()));
    message.append("String_Node_Str");
    message.append("String_Node_Str");
    message.append("String_Node_Str");
    message.append(Integer.toHexString(swatch.getRgb()).toUpperCase());
    message.append(System.getProperty("String_Node_Str"));
  }
  return message.toString();
}
Program: 131152
Project: 131152
Buggy source:
private void drawPage(PdfDocument.Page page){
  Canvas canvas=page.getCanvas();
  StringBuilder token;
  int titleBaseLine=72;
  int leftMargin=54;
  Paint paint=new Paint();
  paint.setColor(Color.BLACK);
  paint.setTextSize(20);
  canvas.drawText(context.getString(R.string.app_name),leftMargin,titleBaseLine,paint);
  paint.setTextSize(16);
  canvas.drawText(filename + "String_Node_Str",leftMargin,titleBaseLine + 25,paint);
  paint.setTextSize(14);
  for (int i=0; i < swatches.size(); i++) {
    paint.setColor(Color.BLACK);
    token=new StringBuilder();
    token.append("String_Node_Str" + UPalette.getSwatchDescription(context,swatches.get(i).getType()));
    canvas.drawText(token.toString(),leftMargin,titleBaseLine + (50 + (i * 100)),paint);
    token=new StringBuilder();
    token.append("String_Node_Str" + Integer.toHexString(swatches.get(i).getRgb()).toUpperCase());
    canvas.drawText(token.toString(),leftMargin,titleBaseLine + (75 + (i * 100)),paint);
    paint.setColor(swatches.get(i).getRgb());
    canvas.drawRect(leftMargin,titleBaseLine + (90 + (i * 100)),126,titleBaseLine + (90 + (i * 100)) + 30,paint);
  }
  if (message != null) {
    paint.setColor(Color.BLACK);
    paint.setTextSize(10);
    canvas.drawText(message,leftMargin,titleBaseLine + (50 + (swatches.size() * 100)) + 10,paint);
  }
}

Fixed version (ground truth):
private void drawPage(PdfDocument.Page page){
  Canvas canvas=page.getCanvas();
  StringBuilder token;
  int titleBaseLine=72;
  int leftMargin=54;
  Paint paint=new Paint();
  paint.setColor(Color.BLACK);
  paint.setTextSize(20);
  canvas.drawText(context.getString(R.string.app_name),leftMargin,titleBaseLine,paint);
  paint.setTextSize(16);
  canvas.drawText(filename + "String_Node_Str",leftMargin,titleBaseLine + 25,paint);
  paint.setTextSize(14);
  for (int i=0; i < swatches.size(); i++) {
    paint.setColor(Color.BLACK);
    token=new StringBuilder();
    token.append("String_Node_Str");
    token.append(UPalette.getSwatchDescription(context,swatches.get(i).getType()));
    canvas.drawText(token.toString(),leftMargin,titleBaseLine + (50 + (i * 100)),paint);
    token=new StringBuilder();
    token.append("String_Node_Str");
    token.append(Integer.toHexString(swatches.get(i).getRgb()).toUpperCase());
    canvas.drawText(token.toString(),leftMargin,titleBaseLine + (75 + (i * 100)),paint);
    paint.setColor(swatches.get(i).getRgb());
    canvas.drawRect(leftMargin,titleBaseLine + (90 + (i * 100)),126,titleBaseLine + (90 + (i * 100)) + 30,paint);
  }
  if (message != null) {
    paint.setColor(Color.BLACK);
    paint.setTextSize(10);
    canvas.drawText(message,leftMargin,titleBaseLine + (50 + (swatches.size() * 100)) + 10,paint);
  }
}
Program: 131153
Project: 131153
Buggy source:
@Override public Dialog onCreateDialog(Bundle savedInstanceState){
  AlertDialog.Builder builder=new AlertDialog.Builder(getActivity());
  LayoutInflater inflater=getActivity().getLayoutInflater();
  View view=inflater.inflate(R.layout.dialog_rgba_insertion,null);
  ButterKnife.inject(this,view);
  pickerR.setMinValue(0);
  pickerR.setMaxValue(255);
  pickerG.setMinValue(0);
  pickerG.setMaxValue(255);
  pickerB.setMinValue(0);
  pickerB.setMaxValue(255);
  pickerA.setMinValue(0);
  pickerA.setMaxValue(255);
  if (getArguments() != null) {
    rgbaValues=getArguments().getShortArray(ARG_RGBA_VALUES);
  }
  if (rgbaValues != null) {
    pickerR.setValue(rgbaValues[0]);
    pickerG.setValue(rgbaValues[1]);
    pickerB.setValue(rgbaValues[2]);
    pickerA.setValue(rgbaValues[3]);
  }
 else {
    pickerR.setValue(0);
    pickerG.setValue(0);
    pickerB.setValue(0);
    pickerA.setValue(0);
  }
  builder.setView(view).setTitle(getString(R.string.rgba_insertion_dialog_title)).setPositiveButton(getString(R.string.print_color_dialog_message_set),new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int id){
      short[] rgbaValues=new short[]{(short)pickerR.getValue(),(short)pickerG.getValue(),(short)pickerB.getValue(),(short)pickerA.getValue()};
      EventBus.getDefault().post(new RGBAInsertionEvent(rgbaValues));
      RgbaInsertionFragment.this.getDialog().cancel();
    }
  }
);
  return builder.create();
}

Fixed version (ground truth):
@Override public Dialog onCreateDialog(Bundle savedInstanceState){
  AlertDialog.Builder builder=new AlertDialog.Builder(getActivity());
  LayoutInflater inflater=getActivity().getLayoutInflater();
  View view=inflater.inflate(R.layout.dialog_rgba_insertion,null);
  ButterKnife.inject(this,view);
  pickerR.setMinValue(0);
  pickerR.setMaxValue(255);
  pickerG.setMinValue(0);
  pickerG.setMaxValue(255);
  pickerB.setMinValue(0);
  pickerB.setMaxValue(255);
  pickerA.setMinValue(0);
  pickerA.setMaxValue(255);
  if (getArguments() != null) {
    rgbaValues=getArguments().getShortArray(ARG_RGBA_VALUES);
  }
  if (rgbaValues != null) {
    pickerR.setValue(rgbaValues[0]);
    pickerG.setValue(rgbaValues[1]);
    pickerB.setValue(rgbaValues[2]);
    pickerA.setValue(rgbaValues[3]);
  }
 else {
    pickerR.setValue(0);
    pickerG.setValue(0);
    pickerB.setValue(0);
    pickerA.setValue(0);
  }
  builder.setView(view).setTitle(getString(R.string.rgba_insertion_dialog_title)).setPositiveButton(getString(R.string.print_color_dialog_message_set),new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int id){
      pickerR.clearFocus();
      pickerG.clearFocus();
      pickerB.clearFocus();
      pickerA.clearFocus();
      short[] rgbaValues=new short[]{(short)pickerR.getValue(),(short)pickerG.getValue(),(short)pickerB.getValue(),(short)pickerA.getValue()};
      EventBus.getDefault().post(new RGBAInsertionEvent(rgbaValues));
      RgbaInsertionFragment.this.getDialog().cancel();
    }
  }
);
  return builder.create();
}
Program: 131154
Project: 131154
Buggy source:
@Override public void onClick(DialogInterface dialog,int id){
  short[] rgbaValues=new short[]{(short)pickerR.getValue(),(short)pickerG.getValue(),(short)pickerB.getValue(),(short)pickerA.getValue()};
  EventBus.getDefault().post(new RGBAInsertionEvent(rgbaValues));
  RgbaInsertionFragment.this.getDialog().cancel();
}

Fixed version (ground truth):
@Override public void onClick(DialogInterface dialog,int id){
  pickerR.clearFocus();
  pickerG.clearFocus();
  pickerB.clearFocus();
  pickerA.clearFocus();
  short[] rgbaValues=new short[]{(short)pickerR.getValue(),(short)pickerG.getValue(),(short)pickerB.getValue(),(short)pickerA.getValue()};
  EventBus.getDefault().post(new RGBAInsertionEvent(rgbaValues));
  RgbaInsertionFragment.this.getDialog().cancel();
}
Program: 131156
Project: 131156
Buggy source:
public static void write(FactorGraph fg,BufferedWriter out){
  try {
    out.write(String.format("String_Node_Str",fg.getNumFactors(),fg.getNumVars(),fg.getNumEdges()));
    out.write(getNumNonGlobalFactors(fg) + "String_Node_Str");
    out.write("String_Node_Str");
    for (    Factor f : fg.getFactors()) {
      if (!(f instanceof GlobalFactor)) {
        VarSet vars=f.getVars();
        out.write(vars.size() + "String_Node_Str");
        for (int v=vars.size() - 1; v >= 0; v--) {
          out.write("String_Node_Str" + vars.get(v).getId());
          if (v > 0) {
            out.write("String_Node_Str");
          }
        }
        out.write("String_Node_Str");
        for (int v=vars.size() - 1; v >= 0; v--) {
          out.write("String_Node_Str" + vars.get(v).getNumStates());
          if (v > 0) {
            out.write("String_Node_Str");
          }
        }
        out.write("String_Node_Str");
        int n=vars.calcNumConfigs();
        out.write(n + "String_Node_Str");
        for (int c=0; c < n; c++) {
          out.write(String.format("String_Node_Str",c,Math.exp(f.getLogUnormalizedScore(c))));
        }
        out.write("String_Node_Str");
      }
 else {
        log.warn("String_Node_Str",f.getClass());
      }
    }
    out.close();
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public static void write(FactorGraph fg,BufferedWriter out){
  try {
    out.write(String.format("String_Node_Str",fg.getNumFactors(),fg.getNumVars(),fg.getNumEdges()));
    out.write(getNumNonGlobalFactors(fg) + "String_Node_Str");
    out.write("String_Node_Str");
    for (    Factor f : fg.getFactors()) {
      if (!(f instanceof GlobalFactor)) {
        VarSet vars=f.getVars();
        out.write(vars.size() + "String_Node_Str");
        out.write(vars.stream().map(v -> Integer.toString(v.getId())).collect(Collectors.joining("String_Node_Str")));
        out.write("String_Node_Str");
        out.write(vars.stream().map(v -> Integer.toString(v.getNumStates())).collect(Collectors.joining("String_Node_Str")));
        out.write("String_Node_Str");
        int n=vars.calcNumConfigs();
        int nNonZero=0;
        for (int c=0; c < n; c++) {
          if (Math.exp(f.getLogUnormalizedScore(c)) > 0) {
            nNonZero++;
          }
        }
        out.write(nNonZero + "String_Node_Str");
        for (int c=0; c < n; c++) {
          double prob=Math.exp(f.getLogUnormalizedScore(c));
          if (prob > 0) {
            out.write(String.format("String_Node_Str",configIdToLibDaiIx(c,vars),prob));
          }
        }
        out.write("String_Node_Str");
      }
 else {
        log.warn("String_Node_Str",f.getClass());
      }
    }
    out.close();
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}
Program: 131157
Project: 131157
Buggy source:
public static void assertArrayEquals(boolean[] a1,boolean[] a2){
  Assert.assertEquals(a1.length,a2.length);
  for (int i=0; i < a1.length; i++) {
    Assert.assertEquals("String_Node_Str" + i,a1[i],a2[i]);
  }
}

Fixed version (ground truth):
public static void assertArrayEquals(String[] a1,String[] a2){
  Assert.assertArrayEquals(a1,a2);
}
Program: 131158
Project: 131158
Buggy source:
/** 
 * Forward pass: y = \sum_i \sum_{x_i} (b(x_i) - b*(x_i))^2 , where b*(x_i) are the marginals given by taking the gold variable assignment as a point mass distribution. Note the sum is over all variable assignments to the predicted variables.
 */
public Tensor forward(){
  VarTensor[] varBeliefs=inf.getOutput().varBeliefs;
  double l2dist=s.zero();
  for (  Var v : vc.getVars()) {
    if (v.getType() == VarType.PREDICTED) {
      VarTensor marg=varBeliefs[v.getId()];
      int goldState=vc.getState(v);
      for (int c=0; c < marg.size(); c++) {
        double goldMarg=(c == goldState) ? s.one() : s.zero();
        double predMarg=marg.getValue(c);
        double diff=s.minus(Math.max(goldMarg,predMarg),Math.min(goldMarg,predMarg));
        l2dist=s.plus(l2dist,s.times(diff,diff));
      }
    }
  }
  y=Tensor.getScalarTensor(s,l2dist);
  return y;
}

Fixed version (ground truth):
/** 
 * Forward pass: y = \sum_i \sum_{x_i} (b(x_i) - b*(x_i))^2 , where b*(x_i) are the marginals given by taking the gold variable assignment as a point mass distribution. Note the sum is over all variable assignments to the predicted variables.
 */
public Tensor forward(){
  VarTensor[] varBeliefs=inf.getOutput().varBeliefs;
  double l2dist=s.zero();
  for (  Var v : vc.getVars()) {
    if (v.getType() == VarType.PREDICTED) {
      VarTensor marg=varBeliefs[v.getId()];
      int goldState=vc.getState(v);
      for (int c=0; c < marg.size(); c++) {
        double goldMarg=(c == goldState) ? s.one() : s.zero();
        double predMarg=marg.getValue(c);
        double diff=s.minus(Math.max(goldMarg,predMarg),Math.min(goldMarg,predMarg));
        l2dist=s.plus(l2dist,s.times(diff,diff));
      }
    }
  }
  if (s.lt(l2dist,s.zero())) {
    log.warn("String_Node_Str" + l2dist);
  }
  y=Tensor.getScalarTensor(s,l2dist);
  return y;
}
Program: 131159
Project: 131159
Buggy source:
@Override public Module<Tensor> getInstance(FgModelIdentity mid,FactorGraph fg,VarConfig goldConfig,double weight,int curIter,int maxIter){
  Module<Tensor> mt=mtFac.getInstance(mid,fg,goldConfig,1.0,curIter,maxIter);
  ScalarMultiply scale=new ScalarMultiply(mt,weight);
  return new TopoOrder<Tensor>(QLists.getList(mid,scale.getInputs().get(1)),scale,"String_Node_Str");
}

Fixed version (ground truth):
@Override public Module<Tensor> getInstance(FgModelIdentity mid,FactorGraph fg,VarConfig goldConfig,double weight,int curIter,int maxIter){
  Module<Tensor> mt=mtFac.getInstance(mid,fg,goldConfig,1.0,curIter,maxIter);
  Algebra s=mt.getAlgebra();
  ScalarMultiply scale=new ScalarMultiply(mt,s.fromReal(weight));
  return new TopoOrder<Tensor>(QLists.getList(mid,scale.getInputs().get(1)),scale,"String_Node_Str");
}