Program: 91132
Project: 91132
Buggy source:
protected IngestionResult addNewFileEntity(EntityType entityInfo,Connection connection) throws IngestException, SQLException {
  FileType file=entityInfo.getFile();
  IngestionResult ownerResult=null;
  if (file.getOwnerDN() != null) {
    AgentType ownerAgent=AgentType.Factory.newInstance();
    UserAgentType user=UserAgentType.Factory.newInstance();
    user.setAgentID(file.getOwnerDN());
    ownerAgent.setUserAgent(user);
    ownerAgent.setType(AgentEnumType.OTHER);
    ownerResult=addNewAgent(ownerAgent,connection);
  }
  IngestionResult ingestionResult=null;
  if (KomaduUtils.manageDBLock(DBLockConstants.LOCK_ACQUIRE,file.getFileURI(),connection)) {
    Long baseEntityId=addNewBaseEntity(EntityTypeEnum.FILE,entityInfo.getAttributes(),entityInfo.getRole(),entityInfo.getLocation(),connection);
    TupleData tuple=new TupleData();
    tuple.addAttribute("String_Node_Str",baseEntityId,TableAttributeData.DataType.LONG);
    tuple.addAttribute("String_Node_Str",file.getFileURI(),TableAttributeData.DataType.STRING);
    if (ownerResult != null)     tuple.addAttribute("String_Node_Str",ownerResult.getDbId(),TableAttributeData.DataType.LONG);
    tuple.addAttribute("String_Node_Str",KomaduUtils.getTimestamp(file.getCreateDate()),TableAttributeData.DataType.TIMESTAMP);
    tuple.addAttribute("String_Node_Str",file.getSize(),TableAttributeData.DataType.LONG);
    tuple.addAttribute("String_Node_Str",file.getMd5Sum(),TableAttributeData.DataType.STRING);
    tuple.addAttribute("String_Node_Str",file.getFileName(),TableAttributeData.DataType.STRING);
    Long fileId=insertTuple("String_Node_Str",tuple,"String_Node_Str",connection);
    ingestionResult=new IngestionResult(file.getFileURI(),fileId);
    KomaduUtils.manageDBLock(DBLockConstants.LOCK_RELEASE,file.getFileURI(),connection);
  }
  return ingestionResult;
}

Fixed version (ground truth):
protected IngestionResult addNewFileEntity(EntityType entityInfo,Connection connection) throws IngestException, SQLException {
  FileType file=entityInfo.getFile();
  IngestionResult ownerResult=null;
  if (file.getOwnerDN() != null) {
    AgentType ownerAgent=AgentType.Factory.newInstance();
    UserAgentType user=UserAgentType.Factory.newInstance();
    user.setAgentID(file.getOwnerDN());
    ownerAgent.setUserAgent(user);
    ownerAgent.setType(AgentEnumType.OTHER);
    ownerResult=addNewAgent(ownerAgent,connection);
  }
  IngestionResult ingestionResult=null;
  if (KomaduUtils.manageDBLock(DBLockConstants.LOCK_ACQUIRE,file.getFileURI(),connection)) {
    Long baseEntityId=addNewBaseEntity(EntityTypeEnum.FILE,entityInfo.getAttributes(),entityInfo.getRole(),entityInfo.getLocation(),connection);
    TupleData tuple=new TupleData();
    tuple.addAttribute("String_Node_Str",baseEntityId,TableAttributeData.DataType.LONG);
    tuple.addAttribute("String_Node_Str",file.getFileURI(),TableAttributeData.DataType.STRING);
    if (ownerResult != null)     tuple.addAttribute("String_Node_Str",ownerResult.getDbId(),TableAttributeData.DataType.LONG);
    if (file.isSetCreateDate())     tuple.addAttribute("String_Node_Str",KomaduUtils.getTimestamp(file.getCreateDate()),TableAttributeData.DataType.TIMESTAMP);
    tuple.addAttribute("String_Node_Str",file.getSize(),TableAttributeData.DataType.LONG);
    tuple.addAttribute("String_Node_Str",file.getMd5Sum(),TableAttributeData.DataType.STRING);
    tuple.addAttribute("String_Node_Str",file.getFileName(),TableAttributeData.DataType.STRING);
    Long fileId=insertTuple("String_Node_Str",tuple,"String_Node_Str",connection);
    ingestionResult=new IngestionResult(file.getFileURI(),fileId);
    KomaduUtils.manageDBLock(DBLockConstants.LOCK_RELEASE,file.getFileURI(),connection);
  }
  return ingestionResult;
}