Program: 89570
Project: 89570
Buggy source:
/** 
 * Return relevant values as header-like fields (here ANVLRecord, but spec-defined "application/warc-fields" type when written). Field names from from DCMI Terms and the WARC/0.17 specification.
 * @see org.archive.crawler.framework.WriterPoolProcessor#getFirstrecordBody(java.io.File)
 */
@Override protected String getFirstrecordBody(File orderFile){
  ANVLRecord record=new ANVLRecord(7);
  record.addLabelValue("String_Node_Str","String_Node_Str" + Heritrix.getVersion() + "String_Node_Str");
  try {
    InetAddress host=InetAddress.getLocalHost();
    record.addLabelValue("String_Node_Str",host.getHostAddress());
    record.addLabelValue("String_Node_Str",host.getCanonicalHostName());
  }
 catch (  UnknownHostException e) {
    logger.log(Level.WARNING,"String_Node_Str",e);
  }
  record.addLabelValue("String_Node_Str","String_Node_Str");
  record.addLabelValue("String_Node_Str","String_Node_Str");
  try {
    Document doc=XmlUtils.getDocument(orderFile);
    addIfNotBlank(record,"String_Node_Str",XmlUtils.xpathOrNull(doc,"String_Node_Str"));
    addIfNotBlank(record,"String_Node_Str",XmlUtils.xpathOrNull(doc,"String_Node_Str"));
    addIfNotBlank(record,"String_Node_Str",XmlUtils.xpathOrNull(doc,"String_Node_Str"));
    addIfNotBlank(record,"String_Node_Str",XmlUtils.xpathOrNull(doc,"String_Node_Str"));
    addIfNotBlank(record,"String_Node_Str",XmlUtils.xpathOrNull(doc,"String_Node_Str"));
    addIfNotBlank(record,"String_Node_Str",XmlUtils.xpathOrNull(doc,"String_Node_Str"));
    addIfNotBlank(record,"String_Node_Str",XmlUtils.xpathOrNull(doc,"String_Node_Str"));
    addIfNotBlank(record,"String_Node_Str",XmlUtils.xpathOrNull(doc,"String_Node_Str"));
    if (metadataMap == null) {
      metadataMap=getMetadataItems();
    }
  }
 catch (  IOException e) {
    logger.log(Level.WARNING,"String_Node_Str",e);
  }
catch (  AttributeNotFoundException e) {
    e.printStackTrace();
  }
catch (  MBeanException e) {
    e.printStackTrace();
  }
catch (  ReflectionException e) {
    e.printStackTrace();
  }
  String netarchiveSuiteComment="String_Node_Str" + dk.netarkivet.common.Constants.getVersionString();
  ANVLRecord recordNAS=new ANVLRecord(7);
  recordNAS.addLabelValue(HARVESTINFO_VERSION,(String)metadataMap.get(HARVESTINFO_VERSION));
  recordNAS.addLabelValue(HARVESTINFO_JOBID,(String)metadataMap.get(HARVESTINFO_JOBID));
  recordNAS.addLabelValue(HARVESTINFO_CHANNEL,(String)metadataMap.get(HARVESTINFO_CHANNEL));
  recordNAS.addLabelValue(HARVESTINFO_HARVESTNUM,(String)metadataMap.get(HARVESTINFO_HARVESTNUM));
  recordNAS.addLabelValue(HARVESTINFO_ORIGHARVESTDEFINITIONID,(String)metadataMap.get(HARVESTINFO_ORIGHARVESTDEFINITIONID));
  recordNAS.addLabelValue(HARVESTINFO_MAXBYTESPERDOMAIN,(String)metadataMap.get(HARVESTINFO_MAXBYTESPERDOMAIN));
  recordNAS.addLabelValue(HARVESTINFO_MAXOBJECTSPERDOMAIN,(String)metadataMap.get(HARVESTINFO_MAXOBJECTSPERDOMAIN));
  recordNAS.addLabelValue(HARVESTINFO_ORDERXMLNAME,(String)metadataMap.get(HARVESTINFO_ORDERXMLNAME));
  recordNAS.addLabelValue(HARVESTINFO_ORIGHARVESTDEFINITIONNAME,(String)metadataMap.get(HARVESTINFO_ORIGHARVESTDEFINITIONNAME));
  if (metadataMap.containsKey((HARVESTINFO_SCHEDULENAME))) {
    recordNAS.addLabelValue(HARVESTINFO_SCHEDULENAME,(String)metadataMap.get(HARVESTINFO_SCHEDULENAME));
  }
  recordNAS.addLabelValue(HARVESTINFO_HARVESTFILENAMEPREFIX,(String)metadataMap.get(HARVESTINFO_HARVESTFILENAMEPREFIX));
  recordNAS.addLabelValue(HARVESTINFO_JOBSUBMITDATE,(String)metadataMap.get(HARVESTINFO_JOBSUBMITDATE));
  if (metadataMap.containsKey(HARVESTINFO_PERFORMER)) {
    recordNAS.addLabelValue(HARVESTINFO_PERFORMER,(String)metadataMap.get(HARVESTINFO_PERFORMER));
  }
  if (metadataMap.containsKey(HARVESTINFO_AUDIENCE)) {
    recordNAS.addLabelValue(HARVESTINFO_AUDIENCE,(String)metadataMap.get(HARVESTINFO_AUDIENCE));
  }
  return record.toString() + netarchiveSuiteComment + "String_Node_Str"+ recordNAS.toString();
}

Fixed version (ground truth):
/** 
 * Return relevant values as header-like fields (here ANVLRecord, but spec-defined "application/warc-fields" type when written). Field names from from DCMI Terms and the WARC/0.17 specification.
 * @see org.archive.crawler.framework.WriterPoolProcessor#getFirstrecordBody(java.io.File)
 */
@Override protected String getFirstrecordBody(File orderFile){
  ANVLRecord record=new ANVLRecord(7);
  record.addLabelValue("String_Node_Str","String_Node_Str" + Heritrix.getVersion() + "String_Node_Str");
  try {
    InetAddress host=InetAddress.getLocalHost();
    record.addLabelValue("String_Node_Str",host.getHostAddress());
    record.addLabelValue("String_Node_Str",host.getCanonicalHostName());
  }
 catch (  UnknownHostException e) {
    logger.log(Level.WARNING,"String_Node_Str",e);
  }
  record.addLabelValue("String_Node_Str","String_Node_Str");
  record.addLabelValue("String_Node_Str","String_Node_Str");
  try {
    Document doc=XmlUtils.getDocument(orderFile);
    addIfNotBlank(record,"String_Node_Str",XmlUtils.xpathOrNull(doc,"String_Node_Str"));
    addIfNotBlank(record,"String_Node_Str",XmlUtils.xpathOrNull(doc,"String_Node_Str"));
    addIfNotBlank(record,"String_Node_Str",XmlUtils.xpathOrNull(doc,"String_Node_Str"));
    addIfNotBlank(record,"String_Node_Str",XmlUtils.xpathOrNull(doc,"String_Node_Str"));
    addIfNotBlank(record,"String_Node_Str",XmlUtils.xpathOrNull(doc,"String_Node_Str"));
    addIfNotBlank(record,"String_Node_Str",XmlUtils.xpathOrNull(doc,"String_Node_Str"));
    addIfNotBlank(record,"String_Node_Str",XmlUtils.xpathOrNull(doc,"String_Node_Str"));
    addIfNotBlank(record,"String_Node_Str",XmlUtils.xpathOrNull(doc,"String_Node_Str"));
    if (metadataMap == null) {
      metadataMap=getMetadataItems();
    }
  }
 catch (  IOException e) {
    logger.log(Level.WARNING,"String_Node_Str",e);
  }
catch (  AttributeNotFoundException e) {
    logger.log(Level.WARNING,"String_Node_Str",e);
  }
catch (  MBeanException e) {
    logger.log(Level.WARNING,"String_Node_Str",e);
  }
catch (  ReflectionException e) {
    logger.log(Level.WARNING,"String_Node_Str",e);
  }
  String netarchiveSuiteComment="String_Node_Str" + dk.netarkivet.common.Constants.getVersionString();
  ANVLRecord recordNAS=new ANVLRecord(7);
  recordNAS.addLabelValue(HARVESTINFO_VERSION,(String)metadataMap.get(HARVESTINFO_VERSION));
  recordNAS.addLabelValue(HARVESTINFO_JOBID,(String)metadataMap.get(HARVESTINFO_JOBID));
  recordNAS.addLabelValue(HARVESTINFO_CHANNEL,(String)metadataMap.get(HARVESTINFO_CHANNEL));
  recordNAS.addLabelValue(HARVESTINFO_HARVESTNUM,(String)metadataMap.get(HARVESTINFO_HARVESTNUM));
  recordNAS.addLabelValue(HARVESTINFO_ORIGHARVESTDEFINITIONID,(String)metadataMap.get(HARVESTINFO_ORIGHARVESTDEFINITIONID));
  recordNAS.addLabelValue(HARVESTINFO_MAXBYTESPERDOMAIN,(String)metadataMap.get(HARVESTINFO_MAXBYTESPERDOMAIN));
  recordNAS.addLabelValue(HARVESTINFO_MAXOBJECTSPERDOMAIN,(String)metadataMap.get(HARVESTINFO_MAXOBJECTSPERDOMAIN));
  recordNAS.addLabelValue(HARVESTINFO_ORDERXMLNAME,(String)metadataMap.get(HARVESTINFO_ORDERXMLNAME));
  recordNAS.addLabelValue(HARVESTINFO_ORIGHARVESTDEFINITIONNAME,(String)metadataMap.get(HARVESTINFO_ORIGHARVESTDEFINITIONNAME));
  if (metadataMap.containsKey((HARVESTINFO_SCHEDULENAME))) {
    recordNAS.addLabelValue(HARVESTINFO_SCHEDULENAME,(String)metadataMap.get(HARVESTINFO_SCHEDULENAME));
  }
  recordNAS.addLabelValue(HARVESTINFO_HARVESTFILENAMEPREFIX,(String)metadataMap.get(HARVESTINFO_HARVESTFILENAMEPREFIX));
  recordNAS.addLabelValue(HARVESTINFO_JOBSUBMITDATE,(String)metadataMap.get(HARVESTINFO_JOBSUBMITDATE));
  if (metadataMap.containsKey(HARVESTINFO_PERFORMER)) {
    recordNAS.addLabelValue(HARVESTINFO_PERFORMER,(String)metadataMap.get(HARVESTINFO_PERFORMER));
  }
  if (metadataMap.containsKey(HARVESTINFO_AUDIENCE)) {
    recordNAS.addLabelValue(HARVESTINFO_AUDIENCE,(String)metadataMap.get(HARVESTINFO_AUDIENCE));
  }
  return record.toString() + netarchiveSuiteComment + "String_Node_Str"+ recordNAS.toString();
}