nus-yam/ex-repair huggingface dataset:
Program: 142656
Project: 142656
Buggy source:
private boolean parseEdge(ArrayList list){
  EdgeDraft edgeDraft=container.factory().newEdgeDraft();
  for (int i=0; i < list.size(); i+=2) {
    String key=(String)list.get(i);
    Object value=list.get(i + 1);
    if ("String_Node_Str".equals(key)) {
      NodeDraft source=container.getNode(value.toString());
      edgeDraft.setSource(source);
    }
 else     if ("String_Node_Str".equals(key)) {
      NodeDraft target=container.getNode(value.toString());
      edgeDraft.setTarget(target);
    }
 else     if ("String_Node_Str".equals(key)) {
      if (value instanceof Double) {
        edgeDraft.setWeight(((Double)value).floatValue());
      }
    }
 else     if ("String_Node_Str".equals(key)) {
      edgeDraft.setLabel(value.toString());
    }
  }
  boolean ret=addEdgeAttributes(edgeDraft,"String_Node_Str",list);
  container.addEdge(edgeDraft);
  return ret;
}

Fixed version (ground truth):
private boolean parseEdge(ArrayList list){
  EdgeDraft edgeDraft=container.factory().newEdgeDraft();
  for (int i=0; i < list.size(); i+=2) {
    String key=(String)list.get(i);
    Object value=list.get(i + 1);
    if ("String_Node_Str".equals(key)) {
      NodeDraft source=container.getNode(value.toString());
      edgeDraft.setSource(source);
    }
 else     if ("String_Node_Str".equals(key)) {
      NodeDraft target=container.getNode(value.toString());
      edgeDraft.setTarget(target);
    }
 else     if ("String_Node_Str".equals(key) || "String_Node_Str".equals(key)) {
      if (value instanceof Double) {
        edgeDraft.setWeight(((Double)value).floatValue());
      }
    }
 else     if ("String_Node_Str".equals(key)) {
      edgeDraft.setLabel(value.toString());
    }
  }
  boolean ret=addEdgeAttributes(edgeDraft,"String_Node_Str",list);
  container.addEdge(edgeDraft);
  return ret;
}
Program: 142657
Project: 142657
Buggy source:
public void select(Workspace workspace){
  Lookup.getDefault().lookup(DataTablesController.class).setDataTablesEventListener(DataTableTopComponent.this);
  AttributeModel attributeModel=Lookup.getDefault().lookup(AttributeController.class).getModel();
  dataTablesModel=workspace.getLookup().lookup(DataTablesModel.class);
  if (dataTablesModel == null) {
    workspace.add(dataTablesModel=new DataTablesModel(attributeModel.getNodeTable(),attributeModel.getEdgeTable()));
  }
  nodeAvailableColumnsModel=dataTablesModel.getNodeAvailableColumnsModel();
  edgeAvailableColumnsModel=dataTablesModel.getEdgeAvailableColumnsModel();
  hideTable();
  enableTableControls();
  bannerPanel.setVisible(false);
  attributeModel.addAttributeListener(DataTableTopComponent.this);
  graphModel=gc.getModel();
  graphModel.addGraphListener(DataTableTopComponent.this);
  refreshAll();
}

Fixed version (ground truth):
public void select(Workspace workspace){
  Lookup.getDefault().lookup(DataTablesController.class).setDataTablesEventListener(DataTableTopComponent.this);
  AttributeModel attributeModel=Lookup.getDefault().lookup(AttributeController.class).getModel();
  dataTablesModel=workspace.getLookup().lookup(DataTablesModel.class);
  if (dataTablesModel == null) {
    workspace.add(dataTablesModel=new DataTablesModel(attributeModel.getNodeTable(),attributeModel.getEdgeTable()));
  }
  nodeAvailableColumnsModel=dataTablesModel.getNodeAvailableColumnsModel();
  edgeAvailableColumnsModel=dataTablesModel.getEdgeAvailableColumnsModel();
  hideTable();
  enableTableControls();
  attributeModel.addAttributeListener(DataTableTopComponent.this);
  graphModel=gc.getModel();
  graphModel.addGraphListener(DataTableTopComponent.this);
  refreshAllOnce();
}
Program: 142658
Project: 142658
Buggy source:
private void clearAll(){
  clearTableControls();
  clearColumnManipulators();
  clearGeneralActionsButtons();
}

Fixed version (ground truth):
private void clearAll(){
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      clearTableControls();
      clearColumnManipulators();
      clearGeneralActionsButtons();
    }
  }
);
}
Program: 142659
Project: 142659
Buggy source:
private void hideTable(){
  tableScrollPane.setViewportView(null);
}

Fixed version (ground truth):
private void hideTable(){
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      tableScrollPane.setViewportView(null);
    }
  }
);
}
Program: 142660
Project: 142660
Buggy source:
private void refreshAll(){
  if (nodesButton.isEnabled()) {
    refreshTable();
    refreshColumnManipulators();
    refreshGeneralActionsButtons();
  }
}

Fixed version (ground truth):
private synchronized void refreshAll(){
  if (nodesButton.isEnabled()) {
    refreshTable();
    refreshColumnManipulators();
    refreshGeneralActionsButtons();
  }
}
Program: 142661
Project: 142661
Buggy source:
public void selectEdgesTable(){
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      classDisplayed=ClassDisplayed.EDGE;
      refreshAll();
    }
  }
);
}

Fixed version (ground truth):
public void selectEdgesTable(){
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      classDisplayed=ClassDisplayed.EDGE;
      refreshAllOnce();
    }
  }
);
}
Program: 142663
Project: 142663
Buggy source:
public void selectNodesTable(){
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      classDisplayed=ClassDisplayed.NODE;
      refreshAll();
    }
  }
);
}

Fixed version (ground truth):
public void selectNodesTable(){
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      classDisplayed=ClassDisplayed.NODE;
      refreshAllOnce();
    }
  }
);
}
Program: 142664
Project: 142664
Buggy source:
private void initNodesView(){
  Runnable initNodesRunnable=new Runnable(){
    public void run(){
      try {
        String busyMsg=NbBundle.getMessage(DataTableTopComponent.class,"String_Node_Str");
        BusyUtils.BusyLabel busylabel=BusyUtils.createCenteredBusyLabel(tableScrollPane,busyMsg,nodeTable.getOutlineTable());
        busylabel.setBusy(true);
        final AttributeColumn[] cols=nodeAvailableColumnsModel.getAvailableColumns();
        HierarchicalGraph graph;
        if (visibleOnly) {
          graph=graphModel.getHierarchicalGraphVisible();
        }
 else {
          graph=graphModel.getHierarchicalGraph();
        }
        if (graph == null) {
          tableScrollPane.setViewportView(null);
          return;
        }
        nodeTable.refreshModel(graph,cols,dataTablesModel);
        refreshFilterColumns();
        busylabel.setBusy(false);
        nodeTable.scrollToFirstNodeSelected();
      }
 catch (      Exception e) {
        Exceptions.printStackTrace(e);
        JLabel errorLabel=new JLabel(NbBundle.getMessage(DataTableTopComponent.class,"String_Node_Str"),SwingConstants.CENTER);
        tableScrollPane.setViewportView(errorLabel);
      }
    }
  }
;
  Future future=taskExecutor.submit(initNodesRunnable);
}

Fixed version (ground truth):
private void initNodesView(){
  Runnable initNodesRunnable=new Runnable(){
    public void run(){
      try {
        String busyMsg=NbBundle.getMessage(DataTableTopComponent.class,"String_Node_Str");
        BusyUtils.BusyLabel busylabel=BusyUtils.createCenteredBusyLabel(tableScrollPane,busyMsg,nodeTable.getOutlineTable());
        busylabel.setBusy(true);
        final AttributeColumn[] cols=nodeAvailableColumnsModel.getAvailableColumns();
        HierarchicalGraph graph;
        if (visibleOnly) {
          graph=graphModel.getHierarchicalGraphVisible();
        }
 else {
          graph=graphModel.getHierarchicalGraph();
        }
        if (graph == null) {
          tableScrollPane.setViewportView(null);
          return;
        }
        nodeTable.refreshModel(graph,cols,dataTablesModel);
        refreshFilterColumns();
        busylabel.setBusy(false);
        nodeTable.scrollToFirstNodeSelected();
      }
 catch (      Exception e) {
        Exceptions.printStackTrace(e);
        JLabel errorLabel=new JLabel(NbBundle.getMessage(DataTableTopComponent.class,"String_Node_Str"),SwingConstants.CENTER);
        tableScrollPane.setViewportView(errorLabel);
      }
    }
  }
;
  SwingUtilities.invokeLater(initNodesRunnable);
}
Program: 142665
Project: 142665
Buggy source:
private void refreshOnce(boolean refreshTableOnly){
  if (refreshOnceHelperThread == null || !refreshOnceHelperThread.isAlive() || (refreshOnceHelperThread.refreshTableOnly && !refreshTableOnly)) {
    refreshOnceHelperThread=new RefreshOnceHelperThread(refreshTableOnly);
    refreshOnceHelperThread.start();
  }
 else {
    refreshOnceHelperThread.eventAttended();
  }
}

Fixed version (ground truth):
/** 
 * This method ensures that the refreshing of all Data laboratory or table only happens once in a short time period.
 * @param refreshTableOnly True to refresh only table values, false to refresh all UI including manipulators
 */
private void refreshOnce(boolean refreshTableOnly){
  if (refreshOnceHelperThread == null || !refreshOnceHelperThread.isAlive() || (refreshOnceHelperThread.refreshTableOnly && !refreshTableOnly)) {
    refreshOnceHelperThread=new RefreshOnceHelperThread(refreshTableOnly);
    refreshOnceHelperThread.start();
  }
 else {
    refreshOnceHelperThread.eventAttended();
  }
}
Program: 142666
Project: 142666
Buggy source:
@Override public void componentOpened(){
  refreshAll();
}

Fixed version (ground truth):
@Override public void componentOpened(){
  refreshAllOnce();
}
Program: 142667
Project: 142667
Buggy source:
private void availableColumnsButtonActionPerformed(java.awt.event.ActionEvent evt){
  AttributeTable table;
  AvailableColumnsModel availableColumnsModel;
  if (classDisplayed == classDisplayed.NODE) {
    table=Lookup.getDefault().lookup(AttributeController.class).getModel().getNodeTable();
  }
 else {
    table=Lookup.getDefault().lookup(AttributeController.class).getModel().getEdgeTable();
  }
  availableColumnsModel=getTableAvailableColumnsModel(table);
  DialogDescriptor dd=new DialogDescriptor(new AvailableColumnsPanel(table,availableColumnsModel).getValidationPanel(),NbBundle.getMessage(DataTableTopComponent.class,"String_Node_Str"));
  dd.setOptions(new Object[]{DialogDescriptor.OK_OPTION});
  DialogDisplayer.getDefault().notify(dd);
  refreshAll();
  availableColumnsButton.setIcon(ImageUtilities.loadImageIcon("String_Node_Str",true));
}

Fixed version (ground truth):
private void availableColumnsButtonActionPerformed(java.awt.event.ActionEvent evt){
  AttributeTable table;
  AvailableColumnsModel availableColumnsModel;
  if (classDisplayed == classDisplayed.NODE) {
    table=Lookup.getDefault().lookup(AttributeController.class).getModel().getNodeTable();
  }
 else {
    table=Lookup.getDefault().lookup(AttributeController.class).getModel().getEdgeTable();
  }
  availableColumnsModel=getTableAvailableColumnsModel(table);
  DialogDescriptor dd=new DialogDescriptor(new AvailableColumnsPanel(table,availableColumnsModel).getValidationPanel(),NbBundle.getMessage(DataTableTopComponent.class,"String_Node_Str"));
  dd.setOptions(new Object[]{DialogDescriptor.OK_OPTION});
  DialogDisplayer.getDefault().notify(dd);
  refreshAllOnce();
  availableColumnsButton.setIcon(ImageUtilities.loadImageIcon("String_Node_Str",true));
}
Program: 142668
Project: 142668
Buggy source:
/** 
 * Column manipulators related methods:
 */
private void refreshColumnManipulators(){
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      clearColumnManipulators();
      prepareAddColumnButton();
      prepareMergeColumnsButton();
      prepareColumnManipulatorsButtons();
      columnManipulatorsPanel.updateUI();
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Column manipulators related methods:
 */
private void refreshColumnManipulators(){
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      clearColumnManipulators();
      prepareAddColumnButton();
      prepareMergeColumnsButton();
      prepareColumnManipulatorsButtons();
    }
  }
);
}
Program: 142669
Project: 142669
Buggy source:
public void refreshCurrentTable(){
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      refreshTable();
    }
  }
);
}

Fixed version (ground truth):
public void refreshCurrentTable(){
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      refreshOnce(true);
    }
  }
);
}
Program: 142671
Project: 142671
Buggy source:
private void initEdgesView(){
  Runnable initEdgesRunnable=new Runnable(){
    public void run(){
      try {
        String busyMsg=NbBundle.getMessage(DataTableTopComponent.class,"String_Node_Str");
        BusyUtils.BusyLabel busylabel=BusyUtils.createCenteredBusyLabel(tableScrollPane,busyMsg,edgeTable.getTable());
        busylabel.setBusy(true);
        final AttributeColumn[] cols=edgeAvailableColumnsModel.getAvailableColumns();
        HierarchicalGraph graph;
        if (visibleOnly) {
          graph=graphModel.getHierarchicalGraphVisible();
        }
 else {
          graph=graphModel.getHierarchicalGraph();
        }
        if (graph == null) {
          tableScrollPane.setViewportView(null);
          return;
        }
        edgeTable.refreshModel(graph,cols,dataTablesModel);
        refreshFilterColumns();
        busylabel.setBusy(false);
        edgeTable.scrollToFirstEdgeSelected();
      }
 catch (      Exception e) {
        Exceptions.printStackTrace(e);
        JLabel errorLabel=new JLabel(NbBundle.getMessage(DataTableTopComponent.class,"String_Node_Str"),SwingConstants.CENTER);
        tableScrollPane.setViewportView(errorLabel);
      }
    }
  }
;
  Future future=taskExecutor.submit(initEdgesRunnable);
}

Fixed version (ground truth):
private void initEdgesView(){
  Runnable initEdgesRunnable=new Runnable(){
    public void run(){
      try {
        String busyMsg=NbBundle.getMessage(DataTableTopComponent.class,"String_Node_Str");
        BusyUtils.BusyLabel busylabel=BusyUtils.createCenteredBusyLabel(tableScrollPane,busyMsg,edgeTable.getTable());
        busylabel.setBusy(true);
        final AttributeColumn[] cols=edgeAvailableColumnsModel.getAvailableColumns();
        HierarchicalGraph graph;
        if (visibleOnly) {
          graph=graphModel.getHierarchicalGraphVisible();
        }
 else {
          graph=graphModel.getHierarchicalGraph();
        }
        if (graph == null) {
          tableScrollPane.setViewportView(null);
          return;
        }
        edgeTable.refreshModel(graph,cols,dataTablesModel);
        refreshFilterColumns();
        busylabel.setBusy(false);
        edgeTable.scrollToFirstEdgeSelected();
      }
 catch (      Exception e) {
        Exceptions.printStackTrace(e);
        JLabel errorLabel=new JLabel(NbBundle.getMessage(DataTableTopComponent.class,"String_Node_Str"),SwingConstants.CENTER);
        tableScrollPane.setViewportView(errorLabel);
      }
    }
  }
;
  SwingUtilities.invokeLater(initEdgesRunnable);
}
Program: 142672
Project: 142672
Buggy source:
private void enableTableControls(){
  nodesButton.setEnabled(true);
  edgesButton.setEnabled(true);
  configurationButton.setEnabled(true);
  availableColumnsButton.setEnabled(true);
  filterTextField.setEnabled(true);
  columnComboBox.setEnabled(true);
  labelFilter.setEnabled(true);
}

Fixed version (ground truth):
private void enableTableControls(){
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      nodesButton.setEnabled(true);
      edgesButton.setEnabled(true);
      configurationButton.setEnabled(true);
      availableColumnsButton.setEnabled(true);
      filterTextField.setEnabled(true);
      columnComboBox.setEnabled(true);
      labelFilter.setEnabled(true);
    }
  }
);
}
Program: 142673
Project: 142673
Buggy source:
public void refreshModel(HierarchicalGraph graph,AttributeColumn[] cols,final DataTablesModel dataTablesModel){
  showingColumns=cols;
  DynamicModel dm=Lookup.getDefault().lookup(DynamicController.class).getModel();
  if (dm != null) {
    timeIntervalsRenderer.setMinMax(dm.getMin(),dm.getMax());
    currentTimeFormat=dm.getTimeFormat();
    timeIntervalsRenderer.setTimeFormat(currentTimeFormat);
    sparkLinesRenderer.setTimeFormat(currentTimeFormat);
  }
  timeIntervalsRenderer.setDrawGraphics(timeIntervalGraphics);
  refreshingTable=true;
  if (selectedNodes == null) {
    selectedNodes=getNodesFromSelectedRows();
  }
  NodeTreeModel nodeTreeModel=new NodeTreeModel(graph.wrapToTreeNode());
  final OutlineModel mdl=DefaultOutlineModel.createOutlineModel(nodeTreeModel,new NodeRowModel(cols),true);
  outlineTable.setRootVisible(false);
  outlineTable.setRenderDataProvider(new NodeRenderer());
  try {
    SwingUtilities.invokeAndWait(new Runnable(){
      public void run(){
        outlineTable.setModel(mdl);
        NodeDataTable.this.dataTablesModel=dataTablesModel;
        setNodesSelection(selectedNodes);
        selectedNodes=null;
      }
    }
);
  }
 catch (  InterruptedException ex) {
    Exceptions.printStackTrace(ex);
  }
catch (  InvocationTargetException ex) {
    Exceptions.printStackTrace(ex);
  }
  refreshingTable=false;
}

Fixed version (ground truth):
public void refreshModel(HierarchicalGraph graph,AttributeColumn[] cols,final DataTablesModel dataTablesModel){
  showingColumns=cols;
  DynamicModel dm=Lookup.getDefault().lookup(DynamicController.class).getModel();
  if (dm != null) {
    timeIntervalsRenderer.setMinMax(dm.getMin(),dm.getMax());
    currentTimeFormat=dm.getTimeFormat();
    timeIntervalsRenderer.setTimeFormat(currentTimeFormat);
    sparkLinesRenderer.setTimeFormat(currentTimeFormat);
  }
  timeIntervalsRenderer.setDrawGraphics(timeIntervalGraphics);
  refreshingTable=true;
  if (selectedNodes == null) {
    selectedNodes=getNodesFromSelectedRows();
  }
  NodeTreeModel nodeTreeModel=new NodeTreeModel(graph.wrapToTreeNode());
  final OutlineModel mdl=DefaultOutlineModel.createOutlineModel(nodeTreeModel,new NodeRowModel(cols),true);
  outlineTable.setRootVisible(false);
  outlineTable.setRenderDataProvider(new NodeRenderer());
  outlineTable.setModel(mdl);
  NodeDataTable.this.dataTablesModel=dataTablesModel;
  setNodesSelection(selectedNodes);
  selectedNodes=null;
  refreshingTable=false;
}
Program: 142674
Project: 142674
Buggy source:
/** 
 * @param statistics
 */
public void execute(final Statistics pStatistics,LongTaskListener listener){
  final GraphController graphController=Lookup.getDefault().lookup(GraphController.class);
  final GraphModel graphModel=graphController.getModel();
  final AttributeModel attributeModel=Lookup.getDefault().lookup(AttributeController.class).getModel();
  StatisticsBuilder builder=getBuilder(pStatistics.getClass());
  final StatisticsUI[] uis=getUI(pStatistics);
  for (  StatisticsUI s : uis) {
    s.setup(pStatistics);
  }
  model.setRunning(pStatistics,true);
  if (pStatistics instanceof LongTask) {
    LongTaskExecutor executor=new LongTaskExecutor(true,builder.getName(),10);
    if (listener != null) {
      executor.setLongTaskListener(listener);
    }
    executor.execute((LongTask)pStatistics,new Runnable(){
      public void run(){
        pStatistics.execute(graphModel,attributeModel);
        model.setRunning(pStatistics,false);
        for (        StatisticsUI s : uis) {
          model.addResult(s);
          s.unsetup();
        }
        model.addReport(pStatistics);
      }
    }
,builder.getName(),null);
  }
 else {
    pStatistics.execute(graphModel,attributeModel);
    if (listener != null) {
      listener.taskFinished(null);
    }
    model.setRunning(pStatistics,false);
    for (    StatisticsUI s : uis) {
      model.addResult(s);
      s.unsetup();
    }
    model.addReport(pStatistics);
  }
}

Fixed version (ground truth):
/** 
 * @param statistics
 */
public void execute(final Statistics pStatistics,LongTaskListener listener){
  final GraphController graphController=Lookup.getDefault().lookup(GraphController.class);
  final GraphModel graphModel=graphController.getModel();
  final AttributeModel attributeModel=Lookup.getDefault().lookup(AttributeController.class).getModel();
  StatisticsBuilder builder=getBuilder(pStatistics.getClass());
  final StatisticsUI[] uis=getUI(pStatistics);
  for (  StatisticsUI s : uis) {
    s.setup(pStatistics);
  }
  model.setRunning(pStatistics,true);
  if (pStatistics instanceof LongTask) {
    LongTaskExecutor executor=new LongTaskExecutor(true,builder.getName(),10);
    if (listener != null) {
      executor.setLongTaskListener(listener);
    }
    executor.execute((LongTask)pStatistics,new Runnable(){
      public void run(){
        pStatistics.execute(graphModel,attributeModel);
        model.setRunning(pStatistics,false);
        for (        StatisticsUI s : uis) {
          model.addResult(s);
          s.unsetup();
        }
        model.addReport(pStatistics);
      }
    }
,builder.getName(),null);
  }
 else {
    pStatistics.execute(graphModel,attributeModel);
    model.setRunning(pStatistics,false);
    for (    StatisticsUI s : uis) {
      model.addResult(s);
      s.unsetup();
    }
    model.addReport(pStatistics);
    if (listener != null) {
      listener.taskFinished(null);
    }
  }
}
Program: 142675
Project: 142675
Buggy source:
public void execute(HierarchicalGraph graph,AttributeModel attributeModel){
  double edgesCount=graph.getEdgeCount();
  double nodesCount=graph.getNodeCount();
  double multiplier=1;
  if (!isDirected) {
    multiplier=2;
  }
  density=(multiplier * edgesCount) / (nodesCount * nodesCount - nodesCount);
}

Fixed version (ground truth):
public void execute(GraphModel graphModel,AttributeModel attributeModel){
  HierarchicalGraph hgraph;
  if (isDirected) {
    hgraph=graphModel.getHierarchicalDirectedGraphVisible();
  }
 else {
    hgraph=graphModel.getHierarchicalUndirectedGraphVisible();
  }
  double edgesCount=hgraph.getTotalEdgeCount();
  double nodesCount=hgraph.getNodeCount();
  double multiplier=1;
  if (!isDirected) {
    multiplier=2;
  }
  density=(multiplier * edgesCount) / (nodesCount * nodesCount - nodesCount);
}
Program: 142676
Project: 142676
Buggy source:
/** 
 * @param struct
 * @param degrees
 * @param graph
 * @return
 */
public double finalQ(int[] struct,double[] degrees,HierarchicalUndirectedGraph graph,AttributeModel attributeModel){
  AttributeTable nodeTable=attributeModel.getNodeTable();
  AttributeColumn modCol=nodeTable.getColumn(MODULARITY_CLASS);
  if (modCol == null) {
    modCol=nodeTable.addColumn(MODULARITY_CLASS,"String_Node_Str",AttributeType.INT,AttributeOrigin.COMPUTED,new Integer(0));
  }
  double res=0;
  double[] internal=new double[degrees.length];
  for (  Node n : graph.getNodes()) {
    int n_index=structure.map.get(n);
    AttributeRow row=(AttributeRow)n.getNodeData().getAttributes();
    row.setValue(modCol,struct[n_index]);
    for (    Node neighbor : graph.getNeighbors(n)) {
      if (n == neighbor) {
        continue;
      }
      int neigh_index=structure.map.get(neighbor);
      if (struct[neigh_index] == struct[n_index]) {
        internal[struct[neigh_index]]++;
      }
    }
  }
  for (int i=0; i < degrees.length; i++) {
    internal[i]/=2.0;
    res+=(internal[i] / graph.getEdgeCount()) - Math.pow(degrees[i] / (2 * graph.getEdgeCount()),2);
  }
  return res;
}

Fixed version (ground truth):
/** 
 * @param struct
 * @param degrees
 * @param hgraph
 * @return
 */
public double finalQ(int[] struct,double[] degrees,HierarchicalUndirectedGraph hgraph,AttributeModel attributeModel){
  AttributeTable nodeTable=attributeModel.getNodeTable();
  AttributeColumn modCol=nodeTable.getColumn(MODULARITY_CLASS);
  if (modCol == null) {
    modCol=nodeTable.addColumn(MODULARITY_CLASS,"String_Node_Str",AttributeType.INT,AttributeOrigin.COMPUTED,new Integer(0));
  }
  double res=0;
  double[] internal=new double[degrees.length];
  for (  Node n : hgraph.getNodes()) {
    int n_index=structure.map.get(n);
    AttributeRow row=(AttributeRow)n.getNodeData().getAttributes();
    row.setValue(modCol,struct[n_index]);
    for (    Node neighbor : hgraph.getNeighbors(n)) {
      if (n == neighbor) {
        continue;
      }
      int neigh_index=structure.map.get(neighbor);
      if (struct[neigh_index] == struct[n_index]) {
        internal[struct[neigh_index]]++;
      }
    }
  }
  for (int i=0; i < degrees.length; i++) {
    internal[i]/=2.0;
    res+=(internal[i] / hgraph.getTotalEdgeCount()) - Math.pow(degrees[i] / (2 * hgraph.getTotalEdgeCount()),2);
  }
  return res;
}
Program: 142678
Project: 142678
Buggy source:
public void execute(HierarchicalGraph graph,AttributeModel attributeModel){
  isCanceled=false;
  triangles(graph,attributeModel);
}

Fixed version (ground truth):
private void execute(HierarchicalGraph hgraph,AttributeModel attributeModel){
  isCanceled=false;
  triangles(hgraph,attributeModel);
}
Program: 142679
Project: 142679
Buggy source:
/** 
 * @param v - The specific node to count the triangles on.
 */
public void newVertex(int v){
  int[] A=new int[N];
  for (int i=network[v].length() - 1; (i >= 0) && (network[v].get(i) > v); i--) {
    int neighbor=network[v].get(i);
    A[neighbor]=network[v].getCount(i);
  }
  for (int i=network[v].length() - 1; i >= 0; i--) {
    int neighbor=network[v].get(i);
    for (int j=closest_in_array(neighbor); j >= 0; j--) {
      int next=network[neighbor].get(j);
      if (A[next] > 0) {
        triangles[next]+=network[v].getCount(i);
        triangles[v]+=network[v].getCount(i);
        triangles[neighbor]+=A[next];
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * @param v - The specific node to count the triangles on.
 */
private void newVertex(int v){
  int[] A=new int[N];
  for (int i=network[v].length() - 1; (i >= 0) && (network[v].get(i) > v); i--) {
    int neighbor=network[v].get(i);
    A[neighbor]=network[v].getCount(i);
  }
  for (int i=network[v].length() - 1; i >= 0; i--) {
    int neighbor=network[v].get(i);
    for (int j=closest_in_array(neighbor); j >= 0; j--) {
      int next=network[neighbor].get(j);
      if (A[next] > 0) {
        triangles[next]+=network[v].getCount(i);
        triangles[v]+=network[v].getCount(i);
        triangles[neighbor]+=A[next];
      }
    }
  }
}
Program: 142680
Project: 142680
Buggy source:
/** 
 * @param u
 * @param v
 */
public void tr_link_nohigh(int u,int v,int count){
  int iu=0, iv=0, w;
  while ((iu < network[u].length()) && (iv < network[v].length())) {
    if (network[u].get(iu) < network[v].get(iv)) {
      iu++;
    }
 else     if (network[u].get(iu) > network[v].get(iv)) {
      iv++;
    }
 else {
      w=network[u].get(iu);
      if (w >= K) {
        triangles[w]+=count;
      }
      iu++;
      iv++;
    }
  }
}

Fixed version (ground truth):
private void tr_link_nohigh(int u,int v,int count){
  int iu=0, iv=0, w;
  while ((iu < network[u].length()) && (iv < network[v].length())) {
    if (network[u].get(iu) < network[v].get(iv)) {
      iu++;
    }
 else     if (network[u].get(iu) > network[v].get(iv)) {
      iv++;
    }
 else {
      w=network[u].get(iu);
      if (w >= K) {
        triangles[w]+=count;
      }
      iu++;
      iv++;
    }
  }
}
Program: 142682
Project: 142682
Buggy source:
/** 
 * @param v
 * @return
 */
public int closest_in_array(int v){
  int right=network[v].length() - 1;
  if (right < 0) {
    return (-1);
  }
  if (network[v].get(0) >= v) {
    return (-1);
  }
  if (network[v].get(right) < v) {
    return (right);
  }
  if (network[v].get(right) == v) {
    return (right - 1);
  }
  int left=0, mid;
  while (right > left) {
    mid=(left + right) / 2;
    if (v < network[v].get(mid)) {
      right=mid - 1;
    }
 else     if (v > network[v].get(mid)) {
      left=mid + 1;
    }
 else {
      return (mid - 1);
    }
  }
  if (v > network[v].get(right)) {
    return (right);
  }
 else {
    return right - 1;
  }
}

Fixed version (ground truth):
private int closest_in_array(int v){
  int right=network[v].length() - 1;
  if (right < 0) {
    return (-1);
  }
  if (network[v].get(0) >= v) {
    return (-1);
  }
  if (network[v].get(right) < v) {
    return (right);
  }
  if (network[v].get(right) == v) {
    return (right - 1);
  }
  int left=0, mid;
  while (right > left) {
    mid=(left + right) / 2;
    if (v < network[v].get(mid)) {
      right=mid - 1;
    }
 else     if (v > network[v].get(mid)) {
      left=mid + 1;
    }
 else {
      return (mid - 1);
    }
  }
  if (v > network[v].get(right)) {
    return (right);
  }
 else {
    return right - 1;
  }
}
Program: 142684
Project: 142684
Buggy source:
/** 
 * @param col
 * @param S
 * @param graph
 * @param f
 * @param index
 * @param low_index
 * @param indicies
 */
private void tarjans(AttributeColumn col,LinkedList<Node> S,HierarchicalDirectedGraph graph,Node f,int[] index,int[] low_index,HashMap<Node,Integer> indicies){
  int id=indicies.get(f);
  index[id]=count;
  low_index[id]=count;
  count++;
  S.addFirst(f);
  EdgeIterable edgeIter=graph.getOutEdges(f);
  for (  Edge e : edgeIter) {
    Node u=graph.getOpposite(f,e);
    int x=indicies.get(u);
    if (index[x] == 0) {
      tarjans(col,S,graph,u,index,low_index,indicies);
      low_index[id]=Math.min(low_index[x],low_index[id]);
    }
 else     if (S.contains(u)) {
      low_index[id]=Math.min(low_index[id],index[x]);
    }
  }
  if (low_index[id] == index[id]) {
    Node v=null;
    while (v != f) {
      v=S.removeFirst();
      AttributeRow row=(AttributeRow)v.getNodeData().getAttributes();
      row.setValue(col,stronglyCount);
    }
    stronglyCount++;
  }
}

Fixed version (ground truth):
private void tarjans(AttributeColumn col,LinkedList<Node> S,HierarchicalDirectedGraph hgraph,Node f,int[] index,int[] low_index,HashMap<Node,Integer> indicies){
  int id=indicies.get(f);
  index[id]=count;
  low_index[id]=count;
  count++;
  S.addFirst(f);
  EdgeIterable edgeIter=hgraph.getOutEdgesAndMetaOutEdges(f);
  for (  Edge e : edgeIter) {
    Node u=hgraph.getOpposite(f,e);
    int x=indicies.get(u);
    if (index[x] == 0) {
      tarjans(col,S,hgraph,u,index,low_index,indicies);
      low_index[id]=Math.min(low_index[x],low_index[id]);
    }
 else     if (S.contains(u)) {
      low_index[id]=Math.min(low_index[id],index[x]);
    }
  }
  if (low_index[id] == index[id]) {
    Node v=null;
    while (v != f) {
      v=S.removeFirst();
      AttributeRow row=(AttributeRow)v.getNodeData().getAttributes();
      row.setValue(col,stronglyCount);
    }
    stronglyCount++;
  }
}
Program: 142685
Project: 142685
Buggy source:
public void top_tarjans(HierarchicalDirectedGraph graph,AttributeModel attributeModel){
  count=1;
  stronglyCount=0;
  AttributeTable nodeTable=attributeModel.getNodeTable();
  AttributeColumn componentCol=nodeTable.getColumn(STRONG);
  if (componentCol == null) {
    componentCol=nodeTable.addColumn(STRONG,"String_Node_Str",AttributeType.INT,AttributeOrigin.COMPUTED,new Integer(0));
  }
  graph.readLock();
  HashMap<Node,Integer> indicies=new HashMap<Node,Integer>();
  int v=0;
  for (  Node s : graph.getNodes()) {
    indicies.put(s,v);
    v++;
  }
  int N=graph.getNodeCount();
  int[] index=new int[N];
  int[] low_index=new int[N];
  while (true) {
    LinkedList<Node> S=new LinkedList<Node>();
    Node first=null;
    NodeIterable iter=graph.getNodes();
    for (    Node u : iter) {
      if (index[indicies.get(u)] == 0) {
        first=u;
        iter.doBreak();
        break;
      }
    }
    if (first == null) {
      graph.readUnlockAll();
      return;
    }
    tarjans(componentCol,S,graph,first,index,low_index,indicies);
  }
}

Fixed version (ground truth):
private void top_tarjans(HierarchicalDirectedGraph hgraph,AttributeModel attributeModel){
  count=1;
  stronglyCount=0;
  AttributeTable nodeTable=attributeModel.getNodeTable();
  AttributeColumn componentCol=nodeTable.getColumn(STRONG);
  if (componentCol == null) {
    componentCol=nodeTable.addColumn(STRONG,"String_Node_Str",AttributeType.INT,AttributeOrigin.COMPUTED,new Integer(0));
  }
  hgraph.readLock();
  HashMap<Node,Integer> indicies=new HashMap<Node,Integer>();
  int v=0;
  for (  Node s : hgraph.getNodes()) {
    indicies.put(s,v);
    v++;
  }
  int N=hgraph.getNodeCount();
  int[] index=new int[N];
  int[] low_index=new int[N];
  while (true) {
    LinkedList<Node> S=new LinkedList<Node>();
    Node first=null;
    NodeIterable iter=hgraph.getNodes();
    for (    Node u : iter) {
      if (index[indicies.get(u)] == 0) {
        first=u;
        iter.doBreak();
        break;
      }
    }
    if (first == null) {
      hgraph.readUnlockAll();
      return;
    }
    tarjans(componentCol,S,hgraph,first,index,low_index,indicies);
  }
}
Program: 142687
Project: 142687
Buggy source:
public WorkspaceInformationImpl(Project project,String name){
  this.project=project;
  this.name=name;
}

Fixed version (ground truth):
public WorkspaceInformationImpl(Project project,String name){
  this.project=project;
  this.name=name;
  ProjectController pc=Lookup.getDefault().lookup(ProjectController.class);
  if (pc.getCurrentWorkspace() == null) {
    count=0;
  }
  count++;
}
Program: 142688
Project: 142688
Buggy source:
public SearchOptions(Edge[] edgesToSearch,Pattern regexPattern,boolean onlyMatchWholeAttributeValue){
  this.edgesToSearch=edgesToSearch;
  this.regexPattern=regexPattern;
  this.onlyMatchWholeAttributeValue=onlyMatchWholeAttributeValue;
  searchNodes=false;
}

Fixed version (ground truth):
/** 
 * Setup options to search on edges with the given pattern. If edgesToSearch is null, all edges of the graph will be used.
 * @param edgesToSearch
 * @param regexPattern
 * @param onlyMatchWholeAttributeValue
 */
public SearchOptions(Edge[] edgesToSearch,Pattern regexPattern,boolean onlyMatchWholeAttributeValue){
  this.edgesToSearch=edgesToSearch;
  this.regexPattern=regexPattern;
  this.onlyMatchWholeAttributeValue=onlyMatchWholeAttributeValue;
  searchNodes=false;
}
Program: 142689
Project: 142689
Buggy source:
private SearchResult findOnNodes(SearchOptions searchOptions,int rowIndex,int columnIndex){
  GraphElementsController gec=Lookup.getDefault().lookup(GraphElementsController.class);
  SearchResult result=null;
  Node[] nodes=searchOptions.getNodesToSearch();
  AttributeRow row;
  Object value;
  for (; rowIndex < nodes.length; rowIndex++) {
    if (!gec.isNodeInGraph(nodes[rowIndex])) {
      continue;
    }
    row=(AttributeRow)nodes[rowIndex].getNodeData().getAttributes();
    for (; columnIndex < row.countValues(); columnIndex++) {
      value=row.getValue(columnIndex);
      result=matchRegex(value,searchOptions,rowIndex,columnIndex);
      if (result != null) {
        result.setFoundNode(nodes[rowIndex]);
        return result;
      }
      searchOptions.setRegionStart(0);
    }
    columnIndex=0;
  }
  return result;
}

Fixed version (ground truth):
private SearchResult findOnNodes(SearchOptions searchOptions,int rowIndex,int columnIndex){
  GraphElementsController gec=Lookup.getDefault().lookup(GraphElementsController.class);
  SearchResult result=null;
  Set<Integer> columnsToSearch=searchOptions.getColumnsToSearch();
  boolean searchAllColumns=columnsToSearch.isEmpty();
  Node[] nodes=searchOptions.getNodesToSearch();
  AttributeRow row;
  Object value;
  for (; rowIndex < nodes.length; rowIndex++) {
    if (!gec.isNodeInGraph(nodes[rowIndex])) {
      continue;
    }
    row=(AttributeRow)nodes[rowIndex].getNodeData().getAttributes();
    for (; columnIndex < row.countValues(); columnIndex++) {
      if (searchAllColumns || columnsToSearch.contains(columnIndex)) {
        value=row.getValue(columnIndex);
        result=matchRegex(value,searchOptions,rowIndex,columnIndex);
        if (result != null) {
          result.setFoundNode(nodes[rowIndex]);
          return result;
        }
      }
      searchOptions.setRegionStart(0);
    }
    searchOptions.setRegionStart(0);
    columnIndex=0;
  }
  return result;
}
Program: 142690
Project: 142690
Buggy source:
private SearchResult findOnEdges(SearchOptions searchOptions,int rowIndex,int columnIndex){
  GraphElementsController gec=Lookup.getDefault().lookup(GraphElementsController.class);
  SearchResult result=null;
  Edge[] edges=searchOptions.getEdgesToSearch();
  AttributeRow row;
  Object value;
  for (; rowIndex < edges.length; rowIndex++) {
    if (!gec.isEdgeInGraph(edges[rowIndex])) {
      continue;
    }
    row=(AttributeRow)edges[rowIndex].getEdgeData().getAttributes();
    for (; columnIndex < row.countValues(); columnIndex++) {
      value=row.getValue(columnIndex);
      result=matchRegex(value,searchOptions,rowIndex,columnIndex);
      if (result != null) {
        result.setFoundEdge(edges[rowIndex]);
        return result;
      }
      searchOptions.setRegionStart(0);
    }
    columnIndex=0;
  }
  return result;
}

Fixed version (ground truth):
private SearchResult findOnEdges(SearchOptions searchOptions,int rowIndex,int columnIndex){
  GraphElementsController gec=Lookup.getDefault().lookup(GraphElementsController.class);
  SearchResult result=null;
  Set<Integer> columnsToSearch=searchOptions.getColumnsToSearch();
  boolean searchAllColumns=columnsToSearch.isEmpty();
  Edge[] edges=searchOptions.getEdgesToSearch();
  AttributeRow row;
  Object value;
  for (; rowIndex < edges.length; rowIndex++) {
    if (!gec.isEdgeInGraph(edges[rowIndex])) {
      continue;
    }
    row=(AttributeRow)edges[rowIndex].getEdgeData().getAttributes();
    for (; columnIndex < row.countValues(); columnIndex++) {
      if (searchAllColumns || columnsToSearch.contains(columnIndex)) {
        value=row.getValue(columnIndex);
        result=matchRegex(value,searchOptions,rowIndex,columnIndex);
        if (result != null) {
          result.setFoundEdge(edges[rowIndex]);
          return result;
        }
      }
      searchOptions.setRegionStart(0);
    }
    searchOptions.setRegionStart(0);
    columnIndex=0;
  }
  return result;
}
Program: 142693
Project: 142693
Buggy source:
private boolean isEdgeDefaultColumn(String id){
  for (  EdgeColumnsGDF c : defaultEdgeColumnsGDFs) {
    if (c.title.equals(id.toLowerCase())) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean isEdgeDefaultColumn(String id){
  for (  EdgeColumnsGDF c : defaultEdgeColumnsGDFs) {
    if (c.title.equalsIgnoreCase(id)) {
      return true;
    }
  }
  return false;
}
Program: 142694
Project: 142694
Buggy source:
private boolean isNodeDefaultColumn(String id){
  for (  NodeColumnsGDF c : defaultNodeColumnsGDFs) {
    if (c.title.equals(id.toLowerCase())) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean isNodeDefaultColumn(String id){
  for (  NodeColumnsGDF c : defaultNodeColumnsGDFs) {
    if (c.title.equalsIgnoreCase(id)) {
      return true;
    }
  }
  return false;
}
Program: 142701
Project: 142701
Buggy source:
/** 
 * <p>Creates and edge between source and target node (if it does not already exist), directed or undirected.</p> <p>If a edge with the given id already exists, no edge will be created.</p> <p>This will not create a self-loop.</p>
 * @param source Source node
 * @param target Target node
 * @param directed Indicates if the edge has to be directed
 * @return New edge if the edge was created succesfully, null otherwise
 */
Edge createEdge(String id,Node source,Node target,boolean directed);

Fixed version (ground truth):
/** 
 * <p>Creates and edge between source and target node (if it does not already exist), directed or undirected.</p> <p>If a edge with the given id already exists, no edge will be created.</p>
 * @param source Source node
 * @param target Target node
 * @param directed Indicates if the edge has to be directed
 * @return New edge if the edge was created succesfully, null otherwise
 */
Edge createEdge(String id,Node source,Node target,boolean directed);
Program: 142703
Project: 142703
Buggy source:
public AttributeColumn createBooleanMatchesColumn(AttributeTable table,AttributeColumn column,String newColumnTitle,Pattern pattern){
  if (pattern != null) {
    AttributeColumn newColumn=addAttributeColumn(table,newColumnTitle,AttributeType.BOOLEAN);
    if (newColumn == null) {
      return null;
    }
    Matcher matcher;
    Object value;
    for (    Attributes row : getTableAttributeRows(table)) {
      value=row.getValue(column.getIndex());
      if (value != null) {
        matcher=pattern.matcher(value.toString());
      }
 else {
        matcher=pattern.matcher("String_Node_Str");
      }
      row.setValue(newColumn.getIndex(),new Boolean(matcher.matches()));
    }
    return newColumn;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
public AttributeColumn createBooleanMatchesColumn(AttributeTable table,AttributeColumn column,String newColumnTitle,Pattern pattern){
  if (pattern != null) {
    AttributeColumn newColumn=addAttributeColumn(table,newColumnTitle,AttributeType.BOOLEAN);
    if (newColumn == null) {
      return null;
    }
    Matcher matcher;
    Object value;
    for (    Attributes row : getTableAttributeRows(table)) {
      value=row.getValue(column.getIndex());
      if (value != null) {
        matcher=pattern.matcher(value.toString());
      }
 else {
        matcher=pattern.matcher("String_Node_Str");
      }
      row.setValue(newColumn.getIndex(),matcher.matches());
    }
    return newColumn;
  }
 else {
    return null;
  }
}
Program: 142705
Project: 142705
Buggy source:
public Edge createEdge(String id,Node source,Node target,boolean directed){
  Edge newEdge;
  if (getGraph().getEdge(id) == null) {
    if (source != target) {
      if (directed) {
        newEdge=buildEdge(id,source,target,true);
        if (getDirectedGraph().addEdge(newEdge)) {
          return newEdge;
        }
 else {
          return null;
        }
      }
 else {
        newEdge=buildEdge(id,source,target,false);
        if (getUndirectedGraph().addEdge(newEdge)) {
          return newEdge;
        }
 else {
          return null;
        }
      }
    }
 else {
      return null;
    }
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
public Edge createEdge(String id,Node source,Node target,boolean directed){
  Edge newEdge;
  if (source != target) {
    if (directed) {
      newEdge=buildEdge(id,source,target,true);
      if (getDirectedGraph().addEdge(newEdge)) {
        return newEdge;
      }
 else {
        return null;
      }
    }
 else {
      newEdge=buildEdge(id,source,target,false);
      if (getUndirectedGraph().addEdge(newEdge)) {
        return newEdge;
      }
 else {
        return null;
      }
    }
  }
 else {
    return null;
  }
}
Program: 142706
Project: 142706
Buggy source:
private Node buildNode(String label,String id){
  Node newNode=Lookup.getDefault().lookup(GraphController.class).getModel().factory().newNode(id);
  getGraph().setId(newNode,id);
  newNode.getNodeData().setLabel(label);
  return newNode;
}

Fixed version (ground truth):
private Node buildNode(String label,String id){
  Node newNode=Lookup.getDefault().lookup(GraphController.class).getModel().factory().newNode();
  getGraph().setId(newNode,id);
  newNode.getNodeData().setLabel(label);
  return newNode;
}
Program: 142707
Project: 142707
Buggy source:
/** 
 * <p>Adds a new column to the specified table with the given title and type of column.</p> <p>The title for the new column can't be repeated in the table, null or an empty string.</p>. <p>The id of the column will be set to the title.</p> <p>The <code>AttributeOrigin</code> of the column will be set to <code>DATA</code>.</p> <p>Default column value will be set to null.</p>
 * @param table Table to add the column
 * @param title Title for the new column, can't be repeated in the table, null or empty string
 * @param type Type for the new column
 * @return The created column or null if title is not correct
 */
AttributeColumn addAttributeColumn(AttributeTable table,String title,AttributeType type);

Fixed version (ground truth):
/** 
 * <p>Adds a new column to the specified table with the given title and type of column.</p> <p>The title for the new column can't be repeated in the table, null or an empty string.</p>. <p>The id of the column will be set to the title.</p> <p>The <code>AttributeOrigin</code> of the column will be set to <code>DATA</code>.</p> <p>Default column value will be set to null.</p>
 * @param table Table to add the column
 * @param title Title for the new column, can't be repeated in the table, null or empty string
 * @param type Type for the new column
 * @return The created column or null if the column could not be created
 */
AttributeColumn addAttributeColumn(AttributeTable table,String title,AttributeType type);
Program: 142708
Project: 142708
Buggy source:
/** 
 * <p>Duplicates a given column of a table and copies al row values.</p> <p>If the <code>AttributeType</code> for the new column is different from the old column type, it will try to parse each value. If it is not possible, the value will be set to null.</p> <p>The title for the new column can't be repeated in the table, null or an empty string.</p>. <p>The id of the column will be set to the title.</p> <p>The <code>AttributeOrigin</code> of the column will be set to <code>DATA</code>.</p> <p>Default column value will be set to null.</p>
 * @param table Table of the column to duplicate
 * @param column Column to duplicate
 * @param title Title for the new column
 * @param type AttributeType for the new column
 * @return The created column or null if title is not correct
 */
AttributeColumn duplicateColumn(AttributeTable table,AttributeColumn column,String title,AttributeType type);

Fixed version (ground truth):
/** 
 * <p>Duplicates a given column of a table and copies al row values.</p> <p>If the <code>AttributeType</code> for the new column is different from the old column type, it will try to parse each value. If it is not possible, the value will be set to null.</p> <p>The title for the new column can't be repeated in the table, null or an empty string.</p>. <p>The id of the column will be set to the title.</p> <p>The <code>AttributeOrigin</code> of the column will be set to <code>DATA</code>.</p> <p>Default column value will be set to null.</p>
 * @param table Table of the column to duplicate
 * @param column Column to duplicate
 * @param title Title for the new column
 * @param type AttributeType for the new column
 * @return The created column or null if the column could not be created
 */
AttributeColumn duplicateColumn(AttributeTable table,AttributeColumn column,String title,AttributeType type);
Program: 142709
Project: 142709
Buggy source:
public void actionPerformed(ActionEvent e){
  try {
    stream.reset();
  }
 catch (  IOException ex) {
    Exceptions.printStackTrace(ex);
  }
  ImportControllerUI importController=Lookup.getDefault().lookup(ImportControllerUI.class);
  importController.importStream(stream,importer);
  WelcomeTopComponent.this.close();
}

Fixed version (ground truth):
public void actionPerformed(ActionEvent e){
  try {
    stream.reset();
  }
 catch (  IOException ex) {
  }
  ImportControllerUI importController=Lookup.getDefault().lookup(ImportControllerUI.class);
  importController.importStream(stream,importer);
  WelcomeTopComponent.this.close();
}
Program: 142712
Project: 142712
Buggy source:
public Object getValueFor(ImmutableTreeNode node){
  Node graphNode=node.getNode();
  if (graphNode.getId() == -1) {
    return null;
  }
  Attributes row=graphNode.getNodeData().getAttributes();
  Object value=row.getValue(column.getIndex());
  if (useSparklines && (AttributeUtils.getDefault().isNumberListColumn(column) || AttributeUtils.getDefault().isDynamicNumberColumn(column))) {
    return value;
  }
 else   if (column.getType() == AttributeType.TIME_INTERVAL) {
    return value;
  }
 else {
    if (value != null) {
      if (value instanceof DynamicType) {
        return ((DynamicType)value).toString(currentTimeFormat == TimeFormat.DOUBLE);
      }
 else {
        return value.toString();
      }
    }
 else {
      return null;
    }
  }
}

Fixed version (ground truth):
public Object getValueFor(ImmutableTreeNode node){
  Node graphNode=node.getNode();
  if (graphNode.getId() == -1) {
    return null;
  }
  Attributes row=graphNode.getNodeData().getAttributes();
  Object value=row.getValue(column.getIndex());
  if (useSparklines && (attributeUtils.isNumberListColumn(column) || attributeUtils.isDynamicNumberColumn(column))) {
    return value;
  }
 else   if (column.getType() == AttributeType.TIME_INTERVAL) {
    return value;
  }
 else   if (attributeUtils.isNumberColumn(column)) {
    return value;
  }
 else {
    if (value != null) {
      if (value instanceof DynamicType) {
        return ((DynamicType)value).toString(currentTimeFormat == TimeFormat.DOUBLE);
      }
 else {
        return value.toString();
      }
    }
 else {
      return null;
    }
  }
}