Program: 93057
Project: 93057
Buggy source:
/** 
 * Do the person matching requested for this thread. <p> Implements java.lang.Runnable.run().
 */
public void run(){
  long startTime=System.currentTimeMillis();
  personMatchList=new ArrayList<PersonMatch>();
  Connection conn=Sql.connect();
  Calendar cal=Calendar.getInstance();
  String sql="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str" + Sql.REGULAR_VISIT_TYPE_ID + "String_Node_Str"+ "String_Node_Str"+ Sql.ONE_OFF_VISIT_TYPE_ID+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ minPersonId+ "String_Node_Str"+ maxPersonId+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  ResultSet rs=Sql.query(conn,sql);
  int recordCount=0;
  FingerprintList fingerprintList=new FingerprintList();
  fingerprintList.loadStart(minPersonId,maxPersonId);
  PersonIdentifierList personIdentifierList=new PersonIdentifierList();
  personIdentifierList.loadStart(minPersonId,maxPersonId);
  try {
    int colPersonId=0, colPersonGuid=0, colSex=0, colBirthdate=0, colDeathdate=0, colFirstName=0, colMiddleName=0, colLastName=0, colOtherName=0, colClanName=0, colMothersFirstName=0, colMothersMiddleName=0, colMothersLastName=0, colFathersFirstName=0, colFathersMiddleName=0, colFathersLastName=0, colCompoundheadFirstName=0, colCompoundheadMiddleName=0, colCompoundheadLastName=0, colVillageName=0, colMaritalStatusName=0, colConsentSigned=0, colVisitRegDate=0, colVisitOneDate=0, colVisitRegAddress=0, colVisitOneAddress=0;
    boolean colsFound=false;
    while (rs.next()) {
      if (!colsFound) {
        colPersonId=rs.findColumn("String_Node_Str");
        colPersonGuid=rs.findColumn("String_Node_Str");
        colSex=rs.findColumn("String_Node_Str");
        colBirthdate=rs.findColumn("String_Node_Str");
        colDeathdate=rs.findColumn("String_Node_Str");
        colFirstName=rs.findColumn("String_Node_Str");
        colMiddleName=rs.findColumn("String_Node_Str");
        colLastName=rs.findColumn("String_Node_Str");
        colOtherName=rs.findColumn("String_Node_Str");
        colClanName=rs.findColumn("String_Node_Str");
        colMothersFirstName=rs.findColumn("String_Node_Str");
        colMothersMiddleName=rs.findColumn("String_Node_Str");
        colMothersLastName=rs.findColumn("String_Node_Str");
        colFathersFirstName=rs.findColumn("String_Node_Str");
        colFathersMiddleName=rs.findColumn("String_Node_Str");
        colFathersLastName=rs.findColumn("String_Node_Str");
        colCompoundheadFirstName=rs.findColumn("String_Node_Str");
        colCompoundheadMiddleName=rs.findColumn("String_Node_Str");
        colCompoundheadLastName=rs.findColumn("String_Node_Str");
        colVillageName=rs.findColumn("String_Node_Str");
        colMaritalStatusName=rs.findColumn("String_Node_Str");
        colConsentSigned=rs.findColumn("String_Node_Str");
        colVisitRegDate=rs.findColumn("String_Node_Str");
        colVisitOneDate=rs.findColumn("String_Node_Str");
        colVisitRegAddress=rs.findColumn("String_Node_Str");
        colVisitOneAddress=rs.findColumn("String_Node_Str");
        colsFound=true;
      }
      Person p=new Person();
      int dbPersonId=rs.getInt(colPersonId);
      p.setPersonGuid(getRsString(rs,colPersonGuid));
      p.setSex((Person.Sex)ValueMap.SEX.getVal().get(getRsString(rs,colSex)));
      p.setBirthdate(rs.getDate(colBirthdate,cal));
      p.setDeathdate(rs.getDate(colDeathdate,cal));
      p.setFirstName(getRsString(rs,colFirstName));
      p.setMiddleName(getRsString(rs,colMiddleName));
      p.setLastName(getRsString(rs,colLastName));
      p.setOtherName(getRsString(rs,colOtherName));
      p.setClanName(getRsString(rs,colClanName));
      p.setMothersFirstName(getRsString(rs,colMothersFirstName));
      p.setMothersMiddleName(getRsString(rs,colMothersMiddleName));
      p.setMothersLastName(getRsString(rs,colMothersLastName));
      p.setFathersFirstName(getRsString(rs,colFathersFirstName));
      p.setFathersMiddleName(getRsString(rs,colFathersMiddleName));
      p.setFathersLastName(getRsString(rs,colFathersLastName));
      p.setCompoundHeadFirstName(getRsString(rs,colCompoundheadFirstName));
      p.setCompoundHeadMiddleName(getRsString(rs,colCompoundheadMiddleName));
      p.setCompoundHeadLastName(getRsString(rs,colCompoundheadLastName));
      p.setVillageName(getRsString(rs,colVillageName));
      p.setMaritalStatus((Person.MaritalStatus)ValueMap.MARITAL_STATUS.getVal().get(getRsString(rs,colMaritalStatusName)));
      p.setPersonIdentifierList(personIdentifierList.loadNext(dbPersonId));
      p.setFingerprintList(fingerprintList.loadNext(dbPersonId));
      p.setConsentSigned((Person.ConsentSigned)ValueMap.CONSENT_SIGNED.getVal().get(getRsString(rs,colConsentSigned)));
      p.setLastRegularVisit(Visit.getVisit(rs.getDate(colVisitRegDate),getRsString(rs,colVisitOneDate)));
      p.setLastOneOffVisit(Visit.getVisit(rs.getDate(colVisitRegAddress),getRsString(rs,colVisitOneAddress)));
      PersonMatch per=new PersonMatch(p);
      per.setDbPersonId(dbPersonId);
      personMatchList.add(per);
      if (++recordCount % 1000 == 0) {
        double timeInterval=(System.currentTimeMillis() - startTime);
        Mediator.getLogger(LoadPersonThread.class.getName()).log(Level.FINE,"String_Node_Str",new Object[]{threadIndex,recordCount,timeInterval});
      }
    }
    Sql.close(rs);
  }
 catch (  SQLException ex) {
    Logger.getLogger(LoadPersonThread.class.getName()).log(Level.SEVERE,null,ex);
    System.exit(1);
  }
  Sql.close(conn);
  Sql.close(conn);
  fingerprintList.loadEnd();
  personIdentifierList.loadEnd();
  finishTime=System.currentTimeMillis();
}

Fixed version (ground truth):
/** 
 * Do the person matching requested for this thread. <p> Implements java.lang.Runnable.run().
 */
public void run(){
  long startTime=System.currentTimeMillis();
  Mediator.getLogger(LoadPersonThread.class.getName()).log(Level.FINE,"String_Node_Str",threadIndex);
  personMatchList=new ArrayList<PersonMatch>();
  Connection conn=Sql.connect();
  Calendar cal=Calendar.getInstance();
  String sql="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str" + Sql.REGULAR_VISIT_TYPE_ID + "String_Node_Str"+ "String_Node_Str"+ Sql.ONE_OFF_VISIT_TYPE_ID+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ minPersonId+ "String_Node_Str"+ maxPersonId+ "String_Node_Str"+ threadIndex+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  ResultSet rs=Sql.query(conn,sql);
  int recordCount=0;
  FingerprintList fingerprintList=new FingerprintList();
  fingerprintList.loadStart(minPersonId,maxPersonId);
  PersonIdentifierList personIdentifierList=new PersonIdentifierList();
  personIdentifierList.loadStart(minPersonId,maxPersonId);
  try {
    int colPersonId=0, colPersonGuid=0, colSex=0, colBirthdate=0, colDeathdate=0, colFirstName=0, colMiddleName=0, colLastName=0, colOtherName=0, colClanName=0, colMothersFirstName=0, colMothersMiddleName=0, colMothersLastName=0, colFathersFirstName=0, colFathersMiddleName=0, colFathersLastName=0, colCompoundheadFirstName=0, colCompoundheadMiddleName=0, colCompoundheadLastName=0, colVillageName=0, colMaritalStatusName=0, colConsentSigned=0, colVisitRegDate=0, colVisitOneDate=0, colVisitRegAddress=0, colVisitOneAddress=0;
    boolean colsFound=false;
    while (rs.next()) {
      if (!colsFound) {
        colPersonId=rs.findColumn("String_Node_Str");
        colPersonGuid=rs.findColumn("String_Node_Str");
        colSex=rs.findColumn("String_Node_Str");
        colBirthdate=rs.findColumn("String_Node_Str");
        colDeathdate=rs.findColumn("String_Node_Str");
        colFirstName=rs.findColumn("String_Node_Str");
        colMiddleName=rs.findColumn("String_Node_Str");
        colLastName=rs.findColumn("String_Node_Str");
        colOtherName=rs.findColumn("String_Node_Str");
        colClanName=rs.findColumn("String_Node_Str");
        colMothersFirstName=rs.findColumn("String_Node_Str");
        colMothersMiddleName=rs.findColumn("String_Node_Str");
        colMothersLastName=rs.findColumn("String_Node_Str");
        colFathersFirstName=rs.findColumn("String_Node_Str");
        colFathersMiddleName=rs.findColumn("String_Node_Str");
        colFathersLastName=rs.findColumn("String_Node_Str");
        colCompoundheadFirstName=rs.findColumn("String_Node_Str");
        colCompoundheadMiddleName=rs.findColumn("String_Node_Str");
        colCompoundheadLastName=rs.findColumn("String_Node_Str");
        colVillageName=rs.findColumn("String_Node_Str");
        colMaritalStatusName=rs.findColumn("String_Node_Str");
        colConsentSigned=rs.findColumn("String_Node_Str");
        colVisitRegDate=rs.findColumn("String_Node_Str");
        colVisitOneDate=rs.findColumn("String_Node_Str");
        colVisitRegAddress=rs.findColumn("String_Node_Str");
        colVisitOneAddress=rs.findColumn("String_Node_Str");
        colsFound=true;
      }
      Person p=new Person();
      int dbPersonId=rs.getInt(colPersonId);
      p.setPersonGuid(getRsString(rs,colPersonGuid));
      p.setSex((Person.Sex)ValueMap.SEX.getVal().get(getRsString(rs,colSex)));
      p.setBirthdate(rs.getDate(colBirthdate,cal));
      p.setDeathdate(rs.getDate(colDeathdate,cal));
      p.setFirstName(getRsString(rs,colFirstName));
      p.setMiddleName(getRsString(rs,colMiddleName));
      p.setLastName(getRsString(rs,colLastName));
      p.setOtherName(getRsString(rs,colOtherName));
      p.setClanName(getRsString(rs,colClanName));
      p.setMothersFirstName(getRsString(rs,colMothersFirstName));
      p.setMothersMiddleName(getRsString(rs,colMothersMiddleName));
      p.setMothersLastName(getRsString(rs,colMothersLastName));
      p.setFathersFirstName(getRsString(rs,colFathersFirstName));
      p.setFathersMiddleName(getRsString(rs,colFathersMiddleName));
      p.setFathersLastName(getRsString(rs,colFathersLastName));
      p.setCompoundHeadFirstName(getRsString(rs,colCompoundheadFirstName));
      p.setCompoundHeadMiddleName(getRsString(rs,colCompoundheadMiddleName));
      p.setCompoundHeadLastName(getRsString(rs,colCompoundheadLastName));
      p.setVillageName(getRsString(rs,colVillageName));
      p.setMaritalStatus((Person.MaritalStatus)ValueMap.MARITAL_STATUS.getVal().get(getRsString(rs,colMaritalStatusName)));
      p.setPersonIdentifierList(personIdentifierList.loadNext(dbPersonId));
      p.setFingerprintList(fingerprintList.loadNext(dbPersonId));
      p.setConsentSigned((Person.ConsentSigned)ValueMap.CONSENT_SIGNED.getVal().get(getRsString(rs,colConsentSigned)));
      p.setLastRegularVisit(Visit.getVisit(rs.getDate(colVisitRegDate),getRsString(rs,colVisitOneDate)));
      p.setLastOneOffVisit(Visit.getVisit(rs.getDate(colVisitRegAddress),getRsString(rs,colVisitOneAddress)));
      PersonMatch per=new PersonMatch(p);
      per.setDbPersonId(dbPersonId);
      personMatchList.add(per);
      if (++recordCount % 10000 == 0) {
        double timeInterval=(System.currentTimeMillis() - startTime);
        Mediator.getLogger(LoadPersonThread.class.getName()).log(Level.FINE,"String_Node_Str",new Object[]{threadIndex,recordCount,timeInterval});
      }
    }
  }
 catch (  SQLException ex) {
    Logger.getLogger(LoadPersonThread.class.getName()).log(Level.SEVERE,null,ex);
    System.exit(1);
  }
  Sql.close(rs);
  Sql.close(conn);
  fingerprintList.loadEnd();
  personIdentifierList.loadEnd();
  double timeInterval=(System.currentTimeMillis() - startTime);
  Mediator.getLogger(LoadPersonThread.class.getName()).log(Level.FINE,"String_Node_Str",new Object[]{threadIndex,personMatchList.size(),timeInterval});
}