Program: 51771
Project: 51771
Buggy source:
/** 
 * Parse the CSV import.
 * @param util TODO
 * @param csvfile
 * @return
 * @throws InitializationException
 * @throws BbServiceException
 */
private boolean parseCSV(BlackboardUtil util,Reader csvfile){
  CSVReader reader;
  sets=new HashMap<String,GroupSet>();
  try {
    reader=new CSVReader(csvfile);
    String[] nextLine;
    int lineNum=2;
    Map<Integer,Integer> headerIndexes=parseHeader(reader.readNext());
    if (headerIndexes.get(HEADER_GROUP) == null || (headerIndexes.get(HEADER_USERNAME) == null && headerIndexes.get(HEADER_STUDENTID) == null)) {
      throw new IOException("String_Node_Str");
    }
    while ((nextLine=reader.readNext()) != null) {
      if ((headerIndexes.get(HEADER_GROUP) == null || nextLine[headerIndexes.get(HEADER_GROUP)].trim().isEmpty()) || ((headerIndexes.get(HEADER_USERNAME) == null || nextLine[headerIndexes.get(HEADER_USERNAME)].trim().isEmpty()) && (headerIndexes.get(HEADER_STUDENTID) == null || nextLine[headerIndexes.get(HEADER_STUDENTID)].trim().isEmpty()))) {
        throw new IOException("String_Node_Str" + lineNum + "String_Node_Str");
      }
      if (headerIndexes.get(HEADER_GROUPSET) == null || nextLine[headerIndexes.get(HEADER_GROUPSET)].trim().isEmpty()) {
        nextLine[headerIndexes.get(HEADER_GROUPSET)]=GroupSet.EMPTY_NAME;
      }
      GroupSet set=sets.get(nextLine[headerIndexes.get(HEADER_GROUPSET)].trim());
      if (set == null) {
        set=new GroupSet(nextLine[headerIndexes.get(HEADER_GROUPSET)].trim());
        sets.put(nextLine[headerIndexes.get(HEADER_GROUPSET)],set);
      }
      GroGroup group=set.getGroup(nextLine[headerIndexes.get(HEADER_GROUP)].trim());
      if (group == null) {
        group=new GroGroup(nextLine[headerIndexes.get(HEADER_GROUP)].trim());
        set.addGroup(group);
      }
      GroUser user=null;
      User bbUser=null;
      if (headerIndexes.get(HEADER_USERNAME) != null && !nextLine[headerIndexes.get(HEADER_USERNAME)].trim().isEmpty()) {
        bbUser=util.findUserByUsername(nextLine[headerIndexes.get(HEADER_USERNAME)].trim());
      }
 else {
        bbUser=util.findUserByStudentId(nextLine[headerIndexes.get(HEADER_STUDENTID)].trim());
      }
      if (bbUser == null) {
        throw new IOException("String_Node_Str");
      }
 else {
        user=new GroUser(bbUser);
      }
      if (!group.hasMember(user)) {
        group.addMember(user);
      }
      lineNum++;
    }
  }
 catch (  IOException e) {
    error("String_Node_Str" + e.getMessage());
    return false;
  }
  log("String_Node_Str");
  return true;
}

Fixed version (ground truth):
/** 
 * Parse the CSV import.
 * @param util TODO
 * @param csvfile
 * @return
 * @throws InitializationException
 * @throws BbServiceException
 */
private boolean parseCSV(BlackboardUtil util,Reader csvfile){
  CSVReader reader;
  sets=new HashMap<String,GroupSet>();
  try {
    reader=new CSVReader(csvfile);
    String[] nextLine;
    int lineNum=2;
    Map<Integer,Integer> headerIndexes=parseHeader(reader.readNext());
    Integer groupIndex=headerIndexes.get(HEADER_GROUP);
    Integer usernameIndex=headerIndexes.get(HEADER_USERNAME);
    Integer studentIdIndex=headerIndexes.get(HEADER_STUDENTID);
    Integer groupSetIndex=headerIndexes.get(HEADER_GROUPSET);
    while ((nextLine=reader.readNext()) != null) {
      if (nextLine[groupIndex].trim().isEmpty()) {
        throw new IOException("String_Node_Str" + lineNum + "String_Node_Str");
      }
      if ((usernameIndex == null || nextLine[usernameIndex].trim().isEmpty()) && (studentIdIndex == null || nextLine[studentIdIndex].trim().isEmpty())) {
        throw new IOException("String_Node_Str" + lineNum + "String_Node_Str");
      }
      GroupSet set;
      String groupSetName;
      if (groupSetIndex == null || nextLine[groupSetIndex].trim().isEmpty()) {
        groupSetName=GroupSet.EMPTY_NAME;
      }
 else {
        groupSetName=nextLine[groupSetIndex].trim();
      }
      set=sets.get(groupSetName);
      if (set == null) {
        set=new GroupSet(groupSetName);
        sets.put(groupSetName,set);
      }
      GroGroup group=set.getGroup(nextLine[groupIndex].trim());
      if (group == null) {
        group=new GroGroup(nextLine[groupIndex].trim());
        set.addGroup(group);
      }
      GroUser user=null;
      User bbUser=null;
      if (usernameIndex != null && !nextLine[usernameIndex].trim().isEmpty()) {
        bbUser=util.findUserByUsername(nextLine[usernameIndex].trim());
      }
 else {
        bbUser=util.findUserByStudentId(nextLine[studentIdIndex].trim());
      }
      if (bbUser == null) {
        throw new IOException("String_Node_Str" + lineNum + "String_Node_Str");
      }
 else {
        user=new GroUser(bbUser);
      }
      if (!group.hasMember(user)) {
        group.addMember(user);
      }
      lineNum++;
    }
  }
 catch (  IOException e) {
    error("String_Node_Str" + e.getMessage());
    return false;
  }
  log("String_Node_Str");
  return true;
}