Program: 188752
Project: 188752
Buggy source:
public static SolrInputDocument updateSolrDocument(SolrInputDocument doc,Binary premisBinary) throws GenericException {
  InputStream inputStream=null;
  try {
    inputStream=premisBinary.getContent().createInputStream();
    gov.loc.premis.v3.File premisFile=binaryToFile(inputStream);
    if (premisFile.getOriginalName() != null) {
      doc.setField(RodaConstants.FILE_ORIGINALNAME,premisFile.getOriginalName().getStringValue());
    }
    if (premisFile.getObjectCharacteristicsArray() != null && premisFile.getObjectCharacteristicsArray().length > 0) {
      ObjectCharacteristicsComplexType occt=premisFile.getObjectCharacteristicsArray(0);
      doc.setField(RodaConstants.FILE_SIZE,occt.getSize());
      if (occt.getFixityArray() != null && occt.getFixityArray().length > 0) {
        List<String> hashes=new ArrayList<>();
        for (        FixityComplexType fct : occt.getFixityArray()) {
          StringBuilder fixityPrint=new StringBuilder();
          fixityPrint.append(fct.getMessageDigest());
          fixityPrint.append("String_Node_Str");
          fixityPrint.append(fct.getMessageDigestAlgorithm());
          if (StringUtils.isNotBlank(fct.getMessageDigestOriginator().getStringValue())) {
            fixityPrint.append("String_Node_Str");
            fixityPrint.append(fct.getMessageDigestOriginator().getStringValue());
          }
          fixityPrint.append("String_Node_Str");
          hashes.add(fixityPrint.toString());
        }
        doc.addField(RodaConstants.FILE_HASH,hashes);
      }
      if (occt.getFormatArray() != null && occt.getFormatArray().length > 0) {
        FormatComplexType fct=occt.getFormatArray(0);
        if (fct.getFormatDesignation() != null) {
          doc.addField(RodaConstants.FILE_FILEFORMAT,fct.getFormatDesignation().getFormatName().getStringValue());
          doc.addField(RodaConstants.FILE_FORMAT_VERSION,fct.getFormatDesignation().getFormatVersion());
        }
        FormatRegistryComplexType pronomRegistry=getFormatRegistry(premisFile,RodaConstants.PRESERVATION_REGISTRY_PRONOM);
        if (pronomRegistry != null) {
          if (pronomRegistry.getFormatRegistryKey() != null) {
            doc.addField(RodaConstants.FILE_PRONOM,pronomRegistry.getFormatRegistryKey().getStringValue());
          }
        }
        FormatRegistryComplexType mimeRegistry=getFormatRegistry(premisFile,RodaConstants.PRESERVATION_REGISTRY_MIME);
        if (mimeRegistry != null) {
          if (mimeRegistry.getFormatRegistryKey() != null) {
            doc.addField(RodaConstants.FILE_FORMAT_MIMETYPE,mimeRegistry.getFormatRegistryKey().getStringValue());
          }
        }
      }
      if (occt.getCreatingApplicationArray() != null && occt.getCreatingApplicationArray().length > 0) {
        CreatingApplicationComplexType cact=occt.getCreatingApplicationArray(0);
        if (cact.getCreatingApplicationName() != null) {
          doc.addField(RodaConstants.FILE_CREATING_APPLICATION_NAME,cact.getCreatingApplicationName().getStringValue());
        }
        doc.addField(RodaConstants.FILE_CREATING_APPLICATION_VERSION,cact.getCreatingApplicationVersion());
        doc.addField(RodaConstants.FILE_DATE_CREATED_BY_APPLICATION,cact.getDateCreatedByApplication());
      }
    }
  }
 catch (  XmlException|IOException e) {
    LOGGER.error("String_Node_Str",e);
  }
 finally {
    IOUtils.closeQuietly(inputStream);
  }
  return doc;
}

Fixed version (ground truth):
public static SolrInputDocument updateSolrDocument(SolrInputDocument doc,Binary premisBinary) throws GenericException {
  InputStream inputStream=null;
  try {
    inputStream=premisBinary.getContent().createInputStream();
    gov.loc.premis.v3.File premisFile=binaryToFile(inputStream);
    if (premisFile.getOriginalName() != null) {
      doc.setField(RodaConstants.FILE_ORIGINALNAME,premisFile.getOriginalName().getStringValue());
    }
    if (premisFile.getObjectCharacteristicsArray() != null && premisFile.getObjectCharacteristicsArray().length > 0) {
      ObjectCharacteristicsComplexType occt=premisFile.getObjectCharacteristicsArray(0);
      doc.setField(RodaConstants.FILE_SIZE,occt.getSize());
      if (occt.getFixityArray() != null && occt.getFixityArray().length > 0) {
        List<String> hashes=new ArrayList<>();
        for (        FixityComplexType fct : occt.getFixityArray()) {
          StringBuilder fixityPrint=new StringBuilder();
          fixityPrint.append(fct.getMessageDigest());
          fixityPrint.append("String_Node_Str");
          fixityPrint.append(fct.getMessageDigestAlgorithm().getStringValue());
          if (StringUtils.isNotBlank(fct.getMessageDigestOriginator().getStringValue())) {
            fixityPrint.append("String_Node_Str");
            fixityPrint.append(fct.getMessageDigestOriginator().getStringValue());
          }
          fixityPrint.append("String_Node_Str");
          hashes.add(fixityPrint.toString());
        }
        doc.addField(RodaConstants.FILE_HASH,hashes);
      }
      if (occt.getFormatArray() != null && occt.getFormatArray().length > 0) {
        FormatComplexType fct=occt.getFormatArray(0);
        if (fct.getFormatDesignation() != null) {
          doc.addField(RodaConstants.FILE_FILEFORMAT,fct.getFormatDesignation().getFormatName().getStringValue());
          doc.addField(RodaConstants.FILE_FORMAT_VERSION,fct.getFormatDesignation().getFormatVersion());
        }
        FormatRegistryComplexType pronomRegistry=getFormatRegistry(premisFile,RodaConstants.PRESERVATION_REGISTRY_PRONOM);
        if (pronomRegistry != null) {
          if (pronomRegistry.getFormatRegistryKey() != null) {
            doc.addField(RodaConstants.FILE_PRONOM,pronomRegistry.getFormatRegistryKey().getStringValue());
          }
        }
        FormatRegistryComplexType mimeRegistry=getFormatRegistry(premisFile,RodaConstants.PRESERVATION_REGISTRY_MIME);
        if (mimeRegistry != null) {
          if (mimeRegistry.getFormatRegistryKey() != null) {
            doc.addField(RodaConstants.FILE_FORMAT_MIMETYPE,mimeRegistry.getFormatRegistryKey().getStringValue());
          }
        }
      }
      if (occt.getCreatingApplicationArray() != null && occt.getCreatingApplicationArray().length > 0) {
        CreatingApplicationComplexType cact=occt.getCreatingApplicationArray(0);
        if (cact.getCreatingApplicationName() != null) {
          doc.addField(RodaConstants.FILE_CREATING_APPLICATION_NAME,cact.getCreatingApplicationName().getStringValue());
        }
        doc.addField(RodaConstants.FILE_CREATING_APPLICATION_VERSION,cact.getCreatingApplicationVersion());
        doc.addField(RodaConstants.FILE_DATE_CREATED_BY_APPLICATION,cact.getDateCreatedByApplication());
      }
    }
  }
 catch (  XmlException|IOException e) {
    LOGGER.error("String_Node_Str",e);
  }
 finally {
    IOUtils.closeQuietly(inputStream);
  }
  return doc;
}