Program: 142702
Project: 142702
Buggy source:
public void importCSVToEdgesTable(File file,Character separator,Charset charset,String[] columnNames,AttributeType[] columnTypes,boolean createNewNodes){
  if (columnNames == null || columnNames.length == 0) {
    return;
  }
  if (columnTypes == null || columnNames.length != columnTypes.length) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  CsvReader reader=null;
  try {
    AttributeTable edges=Lookup.getDefault().lookup(AttributeController.class).getModel().getEdgeTable();
    String idColumn=null;
    String sourceColumn=null;
    String targetColumn=null;
    String typeColumn=null;
    ArrayList<AttributeColumn> columnsList=new ArrayList<AttributeColumn>();
    for (int i=0; i < columnNames.length; i++) {
      if (columnNames[i].equalsIgnoreCase("String_Node_Str")) {
        if (idColumn == null) {
          idColumn=columnNames[i];
        }
      }
 else       if (columnNames[i].equalsIgnoreCase("String_Node_Str") && sourceColumn == null) {
        sourceColumn=columnNames[i];
      }
 else       if (columnNames[i].equalsIgnoreCase("String_Node_Str") && targetColumn == null) {
        targetColumn=columnNames[i];
      }
 else       if (columnNames[i].equalsIgnoreCase("String_Node_Str") && typeColumn == null) {
        typeColumn=columnNames[i];
      }
 else       if (edges.hasColumn(columnNames[i])) {
        columnsList.add(edges.getColumn(columnNames[i]));
      }
 else {
        columnsList.add(addAttributeColumn(edges,columnNames[i],columnTypes[i]));
      }
    }
    GraphElementsController gec=Lookup.getDefault().lookup(GraphElementsController.class);
    Graph graph=Lookup.getDefault().lookup(GraphController.class).getModel().getGraph();
    String id=null;
    Edge edge;
    String sourceId, targetId;
    Node source, target;
    String type;
    boolean directed;
    Attributes edgeAttributes;
    reader=new CsvReader(new FileInputStream(file),separator,charset);
    reader.readHeaders();
    while (reader.readRecord()) {
      sourceId=reader.get(sourceColumn);
      targetId=reader.get(targetColumn);
      if (sourceId == null || sourceId.isEmpty() || targetId == null || targetId.isEmpty()) {
        continue;
      }
      source=graph.getNode(sourceId);
      target=graph.getNode(targetId);
      if ((source == null || target == null) && !createNewNodes) {
        continue;
      }
 else {
        if (source == null) {
          source=gec.createNode(null,sourceId);
        }
        if (target == null) {
          target=gec.createNode(null,targetId);
        }
      }
      if (typeColumn != null) {
        type=reader.get(typeColumn);
        if (type != null) {
          directed=!type.equalsIgnoreCase("String_Node_Str");
        }
 else {
          directed=true;
        }
      }
 else {
        directed=true;
      }
      if (idColumn != null) {
        id=reader.get(idColumn);
        if (id == null || id.isEmpty()) {
          edge=gec.createEdge(source,target,directed);
        }
 else {
          edge=gec.createEdge(id,source,target,directed);
          if (edge == null) {
            edge=gec.createEdge(source,target,directed);
          }
        }
      }
 else {
        edge=gec.createEdge(source,target,directed);
      }
      if (edge != null) {
        edgeAttributes=edge.getEdgeData().getAttributes();
        for (        AttributeColumn column : columnsList) {
          setAttributeValue(reader.get(column.getTitle()),edgeAttributes,column);
        }
      }
    }
  }
 catch (  FileNotFoundException ex) {
    Exceptions.printStackTrace(ex);
  }
catch (  IOException ex) {
    Exceptions.printStackTrace(ex);
  }
 finally {
    reader.close();
  }
}

Fixed version (ground truth):
public void importCSVToEdgesTable(File file,Character separator,Charset charset,String[] columnNames,AttributeType[] columnTypes,boolean createNewNodes){
  if (columnNames == null || columnNames.length == 0) {
    return;
  }
  if (columnTypes == null || columnNames.length != columnTypes.length) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  CsvReader reader=null;
  try {
    AttributeTable edges=Lookup.getDefault().lookup(AttributeController.class).getModel().getEdgeTable();
    String idColumn=null;
    String sourceColumn=null;
    String targetColumn=null;
    String typeColumn=null;
    ArrayList<AttributeColumn> columnsList=new ArrayList<AttributeColumn>();
    for (int i=0; i < columnNames.length; i++) {
      if (columnNames[i].equalsIgnoreCase("String_Node_Str")) {
        if (idColumn == null) {
          idColumn=columnNames[i];
        }
      }
 else       if (columnNames[i].equalsIgnoreCase("String_Node_Str") && sourceColumn == null) {
        sourceColumn=columnNames[i];
      }
 else       if (columnNames[i].equalsIgnoreCase("String_Node_Str") && targetColumn == null) {
        targetColumn=columnNames[i];
      }
 else       if (columnNames[i].equalsIgnoreCase("String_Node_Str") && typeColumn == null) {
        typeColumn=columnNames[i];
      }
 else       if (edges.hasColumn(columnNames[i])) {
        columnsList.add(edges.getColumn(columnNames[i]));
      }
 else {
        columnsList.add(addAttributeColumn(edges,columnNames[i],columnTypes[i]));
      }
    }
    GraphElementsController gec=Lookup.getDefault().lookup(GraphElementsController.class);
    Graph graph=Lookup.getDefault().lookup(GraphController.class).getModel().getGraph();
    String id=null;
    Edge edge;
    String sourceId, targetId;
    Node source, target;
    String type;
    boolean directed;
    Attributes edgeAttributes;
    reader=new CsvReader(new FileInputStream(file),separator,charset);
    reader.readHeaders();
    while (reader.readRecord()) {
      sourceId=reader.get(sourceColumn);
      targetId=reader.get(targetColumn);
      if (sourceId == null || sourceId.isEmpty() || targetId == null || targetId.isEmpty()) {
        continue;
      }
      graph.readLock();
      source=graph.getNode(sourceId);
      graph.readUnlock();
      if (source == null) {
        if (createNewNodes) {
          if (source == null) {
            source=gec.createNode(null,sourceId);
          }
        }
 else {
          continue;
        }
      }
      graph.readLock();
      target=graph.getNode(targetId);
      graph.readUnlock();
      if (target == null) {
        if (createNewNodes) {
          if (target == null) {
            target=gec.createNode(null,targetId);
          }
        }
 else {
          continue;
        }
      }
      if (typeColumn != null) {
        type=reader.get(typeColumn);
        if (type != null) {
          directed=!type.equalsIgnoreCase("String_Node_Str");
        }
 else {
          directed=true;
        }
      }
 else {
        directed=true;
      }
      if (idColumn != null) {
        id=reader.get(idColumn);
        if (id == null || id.isEmpty()) {
          edge=gec.createEdge(source,target,directed);
        }
 else {
          edge=gec.createEdge(id,source,target,directed);
          if (edge == null) {
            edge=gec.createEdge(source,target,directed);
          }
        }
      }
 else {
        edge=gec.createEdge(source,target,directed);
      }
      if (edge != null) {
        edgeAttributes=edge.getEdgeData().getAttributes();
        for (        AttributeColumn column : columnsList) {
          setAttributeValue(reader.get(column.getTitle()),edgeAttributes,column);
        }
      }
    }
  }
 catch (  FileNotFoundException ex) {
    Exceptions.printStackTrace(ex);
  }
catch (  IOException ex) {
    Exceptions.printStackTrace(ex);
  }
 finally {
    reader.close();
  }
}