Program: 142532
Project: 142532
Buggy source:
public void importCSVToNodesTable(File file,Character separator,Charset charset,String[] columnNames,AttributeType[] columnTypes,boolean assignNewNodeIds){
  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 nodesTable=Lookup.getDefault().lookup(AttributeController.class).getModel().getNodeTable();
    String idColumn=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 (nodesTable.hasColumn(columnNames[i])) {
        columnsList.add(nodesTable.getColumn(columnNames[i]));
      }
 else {
        columnsList.add(addAttributeColumn(nodesTable,columnNames[i],columnTypes[i]));
      }
    }
    GraphElementsController gec=Lookup.getDefault().lookup(GraphElementsController.class);
    Graph graph=Lookup.getDefault().lookup(GraphController.class).getModel().getGraph();
    String id=null;
    Node node;
    Attributes nodeAttributes;
    reader=new CsvReader(new FileInputStream(file),separator,charset);
    reader.readHeaders();
    while (reader.readRecord()) {
      if (idColumn != null) {
        id=reader.get(idColumn);
        if (id == null || id.isEmpty()) {
          node=gec.createNode(null);
        }
 else {
          graph.readLock();
          node=graph.getNode(id);
          graph.readUnlock();
          if (node != null) {
            if (assignNewNodeIds) {
              node=gec.createNode(null);
            }
          }
 else {
            node=gec.createNode(null,id);
          }
        }
      }
 else {
        node=gec.createNode(null);
      }
      nodeAttributes=node.getNodeData().getAttributes();
      for (      AttributeColumn column : columnsList) {
        setAttributeValue(reader.get(column.getTitle()),nodeAttributes,column);
      }
    }
  }
 catch (  FileNotFoundException ex) {
    Exceptions.printStackTrace(ex);
  }
catch (  IOException ex) {
    Exceptions.printStackTrace(ex);
  }
 finally {
    reader.close();
  }
}

Fixed version (ground truth):
public void importCSVToNodesTable(File file,Character separator,Charset charset,String[] columnNames,AttributeType[] columnTypes,boolean assignNewNodeIds){
  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 nodesTable=Lookup.getDefault().lookup(AttributeController.class).getModel().getNodeTable();
    String idColumn=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 (nodesTable.hasColumn(columnNames[i])) {
        columnsList.add(nodesTable.getColumn(columnNames[i]));
      }
 else {
        columnsList.add(addAttributeColumn(nodesTable,columnNames[i],columnTypes[i]));
      }
    }
    GraphElementsController gec=Lookup.getDefault().lookup(GraphElementsController.class);
    Graph graph=Lookup.getDefault().lookup(GraphController.class).getModel().getGraph();
    String id=null;
    Node node;
    Attributes nodeAttributes;
    reader=new CsvReader(new FileInputStream(file),separator,charset);
    reader.setTrimWhitespace(false);
    reader.readHeaders();
    while (reader.readRecord()) {
      if (idColumn != null) {
        id=reader.get(idColumn);
        if (id == null || id.isEmpty()) {
          node=gec.createNode(null);
        }
 else {
          graph.readLock();
          node=graph.getNode(id);
          graph.readUnlock();
          if (node != null) {
            if (assignNewNodeIds) {
              node=gec.createNode(null);
            }
          }
 else {
            node=gec.createNode(null,id);
          }
        }
      }
 else {
        node=gec.createNode(null);
      }
      nodeAttributes=node.getNodeData().getAttributes();
      for (      AttributeColumn column : columnsList) {
        setAttributeValue(reader.get(column.getTitle()),nodeAttributes,column);
      }
    }
  }
 catch (  FileNotFoundException ex) {
    Exceptions.printStackTrace(ex);
  }
catch (  IOException ex) {
    Exceptions.printStackTrace(ex);
  }
 finally {
    reader.close();
  }
}