Program: 89716
Project: 89716
Buggy source:
/** 
 * Read a single job from the job database.
 * @param jobID ID of the job.
 * @return A Job object
 * @throws UnknownID if the job id does not exist.
 * @throws IOFailure if there was some problem talking to the database.
 */
public synchronized Job read(Long jobID){
  if (!exists(jobID)) {
    throw new UnknownID("String_Node_Str" + jobID + "String_Node_Str");
  }
  Connection dbconnection=DBConnect.getDBConnection();
  PreparedStatement statement=null;
  try {
    statement=dbconnection.prepareStatement("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");
    statement.setLong(1,jobID);
    ResultSet result=statement.executeQuery();
    result.next();
    long harvestID=result.getLong(1);
    JobStatus status=JobStatus.fromOrdinal(result.getInt(2));
    JobPriority pri=JobPriority.fromOrdinal(result.getInt(3));
    long forceMaxCount=result.getLong(4);
    long forceMaxBytes=result.getLong(5);
    String orderxml=result.getString(6);
    Document orderXMLdoc=null;
    boolean useClobs=DBSpecifics.getInstance().supportsClob();
    if (useClobs) {
      Clob clob=result.getClob(7);
      orderXMLdoc=getOrderXMLdocFromClob(clob);
    }
 else {
      orderXMLdoc=XmlUtils.documentFromString(result.getString(7));
    }
    String seedlist="String_Node_Str";
    if (useClobs) {
      Clob clob=result.getClob(8);
      seedlist=clob.getSubString(1,(int)clob.length());
    }
 else {
      seedlist=result.getString(8);
    }
    int harvestNum=result.getInt(9);
    String harvestErrors=result.getString(10);
    String harvestErrorDetails=result.getString(11);
    String uploadErrors=result.getString(12);
    String uploadErrorDetails=result.getString(13);
    Date startdate=DBUtils.getDateMaybeNull(result,14);
    Date stopdate=DBUtils.getDateMaybeNull(result,15);
    Date submittedDate=DBUtils.getDateMaybeNull(result,16);
    Long edition=result.getLong(17);
    Long resubmittedAsJob=DBUtils.getLongMaybeNull(result,18);
    statement.close();
    String domainStatement="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
    if (Settings.get(CommonSettings.DB_SPECIFICS_CLASS).contains(CommonSettings.DB_IS_DERBY_IF_CONTAINS)) {
      statement=dbconnection.prepareStatement(domainStatement + "String_Node_Str");
    }
 else {
      statement=dbconnection.prepareStatement(domainStatement);
    }
    statement.setLong(1,jobID);
    result=statement.executeQuery();
    Map<String,String> configurationMap=new HashMap<String,String>();
    while (result.next()) {
      String domainName=result.getString(1);
      String configName=result.getString(2);
      configurationMap.put(domainName,configName);
    }
    final Job job=new Job(harvestID,configurationMap,pri,forceMaxCount,forceMaxBytes,status,orderxml,orderXMLdoc,seedlist,harvestNum);
    job.appendHarvestErrors(harvestErrors);
    job.appendHarvestErrorDetails(harvestErrorDetails);
    job.appendUploadErrors(uploadErrors);
    job.appendUploadErrorDetails(uploadErrorDetails);
    if (startdate != null) {
      job.setActualStart(startdate);
    }
    if (stopdate != null) {
      job.setActualStop(stopdate);
    }
    if (submittedDate != null) {
      job.setSubmittedDate(submittedDate);
    }
    job.configsChanged=false;
    job.setJobID(jobID);
    job.setEdition(edition);
    if (resubmittedAsJob != null) {
      job.setResubmittedAsJob(resubmittedAsJob);
    }
    return job;
  }
 catch (  SQLException e) {
    String message="String_Node_Str" + jobID + "String_Node_Str"+ "String_Node_Str"+ ExceptionUtils.getSQLExceptionCause(e);
    log.warn(message,e);
    throw new IOFailure(message,e);
  }
catch (  DocumentException e) {
    String message="String_Node_Str" + jobID + "String_Node_Str";
    log.warn(message,e);
    throw new IOFailure(message,e);
  }
 finally {
    DBUtils.closeStatementIfOpen(statement);
  }
}

Fixed version (ground truth):
/** 
 * Read a single job from the job database.
 * @param jobID ID of the job.
 * @return A Job object
 * @throws UnknownID if the job id does not exist.
 * @throws IOFailure if there was some problem talking to the database.
 */
@Override public synchronized Job read(Long jobID){
  if (!exists(jobID)) {
    throw new UnknownID("String_Node_Str" + jobID + "String_Node_Str");
  }
  Connection dbconnection=DBConnect.getDBConnection();
  PreparedStatement statement=null;
  try {
    statement=dbconnection.prepareStatement("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");
    statement.setLong(1,jobID);
    ResultSet result=statement.executeQuery();
    result.next();
    long harvestID=result.getLong(1);
    JobStatus status=JobStatus.fromOrdinal(result.getInt(2));
    JobPriority pri=JobPriority.fromOrdinal(result.getInt(3));
    long forceMaxCount=result.getLong(4);
    long forceMaxBytes=result.getLong(5);
    String orderxml=result.getString(6);
    Document orderXMLdoc=null;
    boolean useClobs=DBSpecifics.getInstance().supportsClob();
    if (useClobs) {
      Clob clob=result.getClob(7);
      orderXMLdoc=getOrderXMLdocFromClob(clob);
    }
 else {
      orderXMLdoc=XmlUtils.documentFromString(result.getString(7));
    }
    String seedlist="String_Node_Str";
    if (useClobs) {
      Clob clob=result.getClob(8);
      seedlist=clob.getSubString(1,(int)clob.length());
    }
 else {
      seedlist=result.getString(8);
    }
    int harvestNum=result.getInt(9);
    String harvestErrors=result.getString(10);
    String harvestErrorDetails=result.getString(11);
    String uploadErrors=result.getString(12);
    String uploadErrorDetails=result.getString(13);
    Date startdate=DBUtils.getDateMaybeNull(result,14);
    Date stopdate=DBUtils.getDateMaybeNull(result,15);
    Date submittedDate=DBUtils.getDateMaybeNull(result,16);
    Long edition=result.getLong(17);
    Long resubmittedAsJob=DBUtils.getLongMaybeNull(result,18);
    statement.close();
    String domainStatement="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
    if (Settings.get(CommonSettings.DB_SPECIFICS_CLASS).contains(CommonSettings.DB_IS_DERBY_IF_CONTAINS)) {
      statement=dbconnection.prepareStatement(domainStatement + "String_Node_Str");
    }
 else {
      statement=dbconnection.prepareStatement(domainStatement);
    }
    statement.setLong(1,jobID);
    result=statement.executeQuery();
    Map<String,String> configurationMap=new HashMap<String,String>();
    while (result.next()) {
      String domainName=result.getString(1);
      String configName=result.getString(2);
      configurationMap.put(domainName,configName);
    }
    final Job job=new Job(harvestID,configurationMap,pri,forceMaxCount,forceMaxBytes,status,orderxml,orderXMLdoc,seedlist,harvestNum);
    job.appendHarvestErrors(harvestErrors);
    job.appendHarvestErrorDetails(harvestErrorDetails);
    job.appendUploadErrors(uploadErrors);
    job.appendUploadErrorDetails(uploadErrorDetails);
    if (startdate != null) {
      job.setActualStart(startdate);
    }
    if (stopdate != null) {
      job.setActualStop(stopdate);
    }
    if (submittedDate != null) {
      job.setSubmittedDate(submittedDate);
    }
    job.configsChanged=false;
    job.setJobID(jobID);
    job.setEdition(edition);
    if (resubmittedAsJob != null) {
      job.setResubmittedAsJob(resubmittedAsJob);
    }
    return job;
  }
 catch (  SQLException e) {
    String message="String_Node_Str" + jobID + "String_Node_Str"+ "String_Node_Str"+ ExceptionUtils.getSQLExceptionCause(e);
    log.warn(message,e);
    throw new IOFailure(message,e);
  }
catch (  DocumentException e) {
    String message="String_Node_Str" + jobID + "String_Node_Str";
    log.warn(message,e);
    throw new IOFailure(message,e);
  }
 finally {
    DBUtils.closeStatementIfOpen(statement);
  }
}