nus-yam/ex-repair huggingface dataset:
Program: 171036
Project: 171036
Buggy source:
@Override @GraphTransaction public AtlasSearchResult searchUsingFullTextQuery(String fullTextQuery,boolean excludeDeletedEntities,int limit,int offset) throws AtlasBaseException {
  AtlasSearchResult ret=new AtlasSearchResult(fullTextQuery,AtlasQueryType.FULL_TEXT);
  QueryParams params=validateSearchParams(limit,offset);
  AtlasIndexQuery idxQuery=toAtlasIndexQuery(fullTextQuery);
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str",fullTextQuery);
  }
  ret.setFullTextResult(getIndexQueryResults(idxQuery,params,excludeDeletedEntities));
  return ret;
}

Fixed version (ground truth):
@Override @GraphTransaction public AtlasSearchResult searchUsingFullTextQuery(String fullTextQuery,boolean excludeDeletedEntities,int limit,int offset) throws AtlasBaseException {
  AtlasSearchResult ret=new AtlasSearchResult(fullTextQuery,AtlasQueryType.FULL_TEXT);
  QueryParams params=QueryParams.getNormalizedParams(limit,offset);
  AtlasIndexQuery idxQuery=toAtlasIndexQuery(fullTextQuery);
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str",fullTextQuery);
  }
  ret.setFullTextResult(getIndexQueryResults(idxQuery,params,excludeDeletedEntities));
  return ret;
}
Program: 171037
Project: 171037
Buggy source:
private GremlinQuery toGremlinQuery(String query,int limit,int offset) throws AtlasBaseException {
  QueryParams params=validateSearchParams(limit,offset);
  GremlinQuery gremlinQuery=new AtlasDSL.Translator(AtlasDSL.Parser.parse(query),typeRegistry,params.offset(),params.limit()).translate();
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str",gremlinQuery.queryStr());
  }
  return gremlinQuery;
}

Fixed version (ground truth):
private GremlinQuery toGremlinQuery(String query,int limit,int offset) throws AtlasBaseException {
  QueryParams params=QueryParams.getNormalizedParams(limit,offset);
  GremlinQuery gremlinQuery=new AtlasDSL.Translator(query,typeRegistry,params.offset(),params.limit()).translate();
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str",gremlinQuery.queryStr());
  }
  return gremlinQuery;
}
Program: 171039
Project: 171039
Buggy source:
public Translator(final AtlasDSLParser.QueryContext queryContext,AtlasTypeRegistry typeRegistry,int offset,int limit){
  this.queryContext=queryContext;
  this.typeRegistry=typeRegistry;
  this.offset=offset;
  this.limit=limit;
}

Fixed version (ground truth):
private Translator(final AtlasDSLParser.QueryContext queryContext,AtlasTypeRegistry typeRegistry,int offset,int limit){
  this.queryContext=queryContext;
  this.typeRegistry=typeRegistry;
  this.offset=offset;
  this.limit=limit;
}
Program: 171040
Project: 171040
Buggy source:
public static AtlasDSLParser.QueryContext parse(String queryStr) throws AtlasBaseException {
  AtlasDSLParser.QueryContext ret;
  try {
    InputStream stream=new ByteArrayInputStream(queryStr.getBytes());
    AtlasDSLLexer lexer=new AtlasDSLLexer(CharStreams.fromStream(stream));
    Validator validator=new Validator();
    TokenStream inputTokenStream=new CommonTokenStream(lexer);
    AtlasDSLParser parser=new AtlasDSLParser(inputTokenStream);
    parser.removeErrorListeners();
    parser.addErrorListener(validator);
    ret=parser.query();
    if (!validator.isValid()) {
      LOG.error("String_Node_Str",queryStr,validator.getErrorMsg());
      throw new AtlasBaseException(AtlasErrorCode.INVALID_DSL_QUERY,queryStr,validator.getErrorMsg());
    }
  }
 catch (  IOException e) {
    throw new AtlasBaseException(e);
  }
  return ret;
}

Fixed version (ground truth):
private static AtlasDSLParser.QueryContext parse(String queryStr) throws AtlasBaseException {
  AtlasDSLParser.QueryContext ret;
  try {
    InputStream stream=new ByteArrayInputStream(queryStr.getBytes());
    AtlasDSLLexer lexer=new AtlasDSLLexer(CharStreams.fromStream(stream));
    Validator validator=new Validator();
    TokenStream inputTokenStream=new CommonTokenStream(lexer);
    AtlasDSLParser parser=new AtlasDSLParser(inputTokenStream);
    parser.removeErrorListeners();
    parser.addErrorListener(validator);
    ret=parser.query();
    if (!validator.isValid()) {
      LOG.error("String_Node_Str",queryStr,validator.getErrorMsg());
      throw new AtlasBaseException(AtlasErrorCode.INVALID_DSL_QUERY,queryStr,validator.getErrorMsg());
    }
  }
 catch (  IOException e) {
    throw new AtlasBaseException(e);
  }
  return ret;
}
Program: 171041
Project: 171041
Buggy source:
public GremlinQuery translate(){
  GremlinQueryComposer gremlinQueryComposer=new GremlinQueryComposer(typeRegistry);
  if (offset >= 0) {
    if (!gremlinQueryComposer.hasLimitOffset()) {
      gremlinQueryComposer.addLimit(Integer.toString(limit),Integer.toString(offset));
    }
  }
  DSLVisitor dslVisitor=new DSLVisitor(gremlinQueryComposer);
  queryContext.accept(dslVisitor);
  return new GremlinQuery(gremlinQueryComposer.get(),gremlinQueryComposer.hasSelect());
}

Fixed version (ground truth):
public GremlinQuery translate(){
  QueryMetadata queryMetadata=new QueryMetadata(queryContext);
  GremlinQueryComposer gremlinQueryComposer=new GremlinQueryComposer(typeRegistry,queryMetadata,limit,offset);
  DSLVisitor dslVisitor=new DSLVisitor(gremlinQueryComposer);
  queryContext.accept(dslVisitor);
  return new GremlinQuery(gremlinQueryComposer.get(),queryMetadata.hasSelect());
}
Program: 171043
Project: 171043
Buggy source:
@Override public Void visitLimitOffset(LimitOffsetContext ctx){
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str",ctx);
  }
  gremlinQueryComposer.addLimit(ctx.limitClause().NUMBER().toString(),(ctx.offsetClause() == null ? "String_Node_Str" : ctx.offsetClause().NUMBER().getText()));
  return super.visitLimitOffset(ctx);
}

Fixed version (ground truth):
@Override public Void visitLimitOffset(LimitOffsetContext ctx){
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str",ctx);
  }
  gremlinQueryComposer.addLimit(ctx.limitClause().NUMBER().getText(),(ctx.offsetClause() == null ? "String_Node_Str" : ctx.offsetClause().NUMBER().getText()));
  return super.visitLimitOffset(ctx);
}
Program: 171044
Project: 171044
Buggy source:
private void processExpr(final CompEContext compE,final GremlinQueryComposer gremlinQueryComposer){
  if (compE != null && compE.isClause() == null && compE.hasClause() == null && compE.isClause() == null) {
    ComparisonClauseContext comparisonClause=compE.comparisonClause();
    if (comparisonClause == null) {
      ExprContext exprContext=compE.arithE().multiE().atomE().expr();
      if (CollectionUtils.isEmpty(exprContext.exprRight())) {
        comparisonClause=exprContext.compE().comparisonClause();
      }
    }
    if (comparisonClause != null) {
      String lhs=comparisonClause.arithE(0).getText();
      String op=comparisonClause.operator().getText().toUpperCase();
      String rhs=comparisonClause.arithE(1).getText();
      gremlinQueryComposer.addWhere(lhs,op,rhs);
    }
 else {
      processExpr(compE.arithE().multiE().atomE().expr(),gremlinQueryComposer);
    }
  }
}

Fixed version (ground truth):
private void processExpr(final CompEContext compE,final GremlinQueryComposer gremlinQueryComposer){
  if (compE != null && compE.isClause() == null && compE.hasClause() == null && compE.isClause() == null) {
    ComparisonClauseContext comparisonClause=compE.comparisonClause();
    if (comparisonClause == null) {
      ExprContext exprContext=compE.arithE().multiE().atomE().expr();
      if (CollectionUtils.isEmpty(exprContext.exprRight())) {
        comparisonClause=exprContext.compE().comparisonClause();
      }
    }
    if (comparisonClause != null) {
      String lhs=comparisonClause.arithE(0).getText();
      String op, rhs;
      AtomEContext atomECtx=comparisonClause.arithE(1).multiE().atomE();
      if (atomECtx.literal() == null || (atomECtx.literal() != null && atomECtx.literal().valueArray() == null)) {
        op=comparisonClause.operator().getText().toUpperCase();
        rhs=comparisonClause.arithE(1).getText();
      }
 else {
        op="String_Node_Str";
        rhs=getInClause(atomECtx);
      }
      gremlinQueryComposer.addWhere(lhs,op,rhs);
    }
 else {
      processExpr(compE.arithE().multiE().atomE().expr(),gremlinQueryComposer);
    }
  }
}
Program: 171045
Project: 171045
Buggy source:
private String getAuditEventDetail(Referenceable entity,EntityAuditAction action) throws AtlasException {
  Map<String,Object> prunedAttributes=pruneEntityAttributesForAudit(entity);
  String auditPrefix=getAuditPrefix(action);
  String auditString=auditPrefix + AtlasType.toV1Json(entity);
  byte[] auditBytes=auditString.getBytes(StandardCharsets.UTF_8);
  long auditSize=auditBytes != null ? auditBytes.length : 0;
  long auditMaxSize=auditRepository.repositoryMaxSize();
  if (auditMaxSize >= 0 && auditSize > auditMaxSize) {
    LOG.warn("String_Node_Str",entity.getTypeName(),entity.getId()._getId(),auditSize,auditMaxSize);
    Map<String,Object> attrValues=entity.getValuesMap();
    clearAttributeValues(entity);
    auditString=auditPrefix + AtlasType.toV1Json(entity);
    addAttributeValues(entity,attrValues);
  }
  restoreEntityAttributes(entity,prunedAttributes);
  return auditString;
}

Fixed version (ground truth):
private String getAuditEventDetail(Referenceable entity,EntityAuditAction action) throws AtlasException {
  Map<String,Object> prunedAttributes=pruneEntityAttributesForAudit(entity);
  String auditPrefix=getAuditPrefix(action);
  String auditString=auditPrefix + AtlasType.toV1Json(entity);
  byte[] auditBytes=auditString.getBytes(StandardCharsets.UTF_8);
  long auditSize=auditBytes != null ? auditBytes.length : 0;
  long auditMaxSize=auditRepository.repositoryMaxSize();
  if (auditMaxSize >= 0 && auditSize > auditMaxSize) {
    LOG.warn("String_Node_Str",entity.getTypeName(),entity.getId()._getId(),auditSize,auditMaxSize);
    Map<String,Object> attrValues=entity.getValuesMap();
    entity.setValues(null);
    auditString=auditPrefix + AtlasType.toV1Json(entity);
    entity.setValues(attrValues);
  }
  restoreEntityAttributes(entity,prunedAttributes);
  return auditString;
}
Program: 171046
Project: 171046
Buggy source:
private Map<String,Object> pruneEntityAttributesForAudit(Referenceable entity) throws AtlasException {
  Map<String,Object> ret=null;
  Map<String,Object> entityAttributes=entity.getValuesMap();
  List<String> excludeAttributes=auditRepository.getAuditExcludeAttributes(entity.getTypeName());
  AtlasEntityType entityType=typeRegistry.getEntityTypeByName(entity.getTypeName());
  if (CollectionUtils.isNotEmpty(excludeAttributes) && MapUtils.isNotEmpty(entityAttributes) && entityType != null) {
    for (    AtlasStructType.AtlasAttribute attribute : entityType.getAllAttributes().values()) {
      String attrName=attribute.getName();
      Object attrValue=entityAttributes.get(attrName);
      if (excludeAttributes.contains(attrName)) {
        if (ret == null) {
          ret=new HashMap<>();
        }
        ret.put(attrName,attrValue);
        entity.setNull(attrName);
      }
 else       if (attribute.isOwnedRef()) {
        if (attrValue instanceof Collection) {
          for (          Object arrElem : (Collection)attrValue) {
            if (arrElem instanceof Referenceable) {
              ret=pruneAttributes(ret,(Referenceable)arrElem);
            }
          }
        }
 else         if (attrValue instanceof Referenceable) {
          ret=pruneAttributes(ret,(Referenceable)attrValue);
        }
      }
    }
  }
  return ret;
}

Fixed version (ground truth):
private Map<String,Object> pruneEntityAttributesForAudit(Referenceable entity) throws AtlasException {
  Map<String,Object> ret=null;
  Map<String,Object> entityAttributes=entity.getValuesMap();
  List<String> excludeAttributes=auditRepository.getAuditExcludeAttributes(entity.getTypeName());
  AtlasEntityType entityType=typeRegistry.getEntityTypeByName(entity.getTypeName());
  if (CollectionUtils.isNotEmpty(excludeAttributes) && MapUtils.isNotEmpty(entityAttributes) && entityType != null) {
    for (    AtlasStructType.AtlasAttribute attribute : entityType.getAllAttributes().values()) {
      String attrName=attribute.getName();
      Object attrValue=entityAttributes.get(attrName);
      if (excludeAttributes.contains(attrName)) {
        if (ret == null) {
          ret=new HashMap<>();
        }
        ret.put(attrName,attrValue);
        entityAttributes.remove(attrName);
      }
 else       if (attribute.isOwnedRef()) {
        if (attrValue instanceof Collection) {
          for (          Object arrElem : (Collection)attrValue) {
            if (arrElem instanceof Referenceable) {
              ret=pruneAttributes(ret,(Referenceable)arrElem);
            }
          }
        }
 else         if (attrValue instanceof Referenceable) {
          ret=pruneAttributes(ret,(Referenceable)attrValue);
        }
      }
    }
  }
  return ret;
}
Program: 171047
Project: 171047
Buggy source:
private void notifyOfEntityEvent(Collection<Referenceable> entityDefinitions,OperationType operationType) throws AtlasException {
  List<EntityNotificationV1> messages=new ArrayList<>();
  for (  Referenceable entityDefinition : entityDefinitions) {
    if (GraphHelper.isInternalType(entityDefinition.getTypeName())) {
      continue;
    }
    Referenceable entity=new Referenceable(entityDefinition);
    Map<String,Object> attributesMap=entity.getValuesMap();
    List<String> entityNotificationAttrs=getNotificationAttributes(entity.getTypeName());
    if (MapUtils.isNotEmpty(attributesMap) && CollectionUtils.isNotEmpty(entityNotificationAttrs)) {
      for (      String entityAttr : attributesMap.keySet()) {
        if (!entityNotificationAttrs.contains(entityAttr)) {
          entity.setNull(entityAttr);
        }
      }
    }
    EntityNotificationV1 notification=new EntityNotificationV1(entity,operationType,getAllTraits(entity,typeRegistry));
    messages.add(notification);
  }
  if (!messages.isEmpty()) {
    notificationInterface.send(NotificationType.ENTITIES,messages);
  }
}

Fixed version (ground truth):
private void notifyOfEntityEvent(Collection<Referenceable> entityDefinitions,OperationType operationType) throws AtlasException {
  List<EntityNotificationV1> messages=new ArrayList<>();
  for (  Referenceable entityDefinition : entityDefinitions) {
    if (GraphHelper.isInternalType(entityDefinition.getTypeName())) {
      continue;
    }
    Referenceable entity=new Referenceable(entityDefinition);
    Map<String,Object> attributesMap=entity.getValuesMap();
    List<String> entityNotificationAttrs=getNotificationAttributes(entity.getTypeName());
    if (MapUtils.isNotEmpty(attributesMap) && CollectionUtils.isNotEmpty(entityNotificationAttrs)) {
      Collection<String> attributesToRemove=CollectionUtils.subtract(attributesMap.keySet(),entityNotificationAttrs);
      for (      String attributeToRemove : attributesToRemove) {
        attributesMap.remove(attributeToRemove);
      }
    }
    EntityNotificationV1 notification=new EntityNotificationV1(entity,operationType,getAllTraits(entity,typeRegistry));
    messages.add(notification);
  }
  if (!messages.isEmpty()) {
    notificationInterface.send(NotificationType.ENTITIES,messages);
  }
}
Program: 171048
Project: 171048
Buggy source:
private <T extends Entity>void processHiveEntity(HiveMetaStoreBridge dgiBridge,HiveEventContext event,T entity,Set<String> dataSetsProcessed,SortedMap<T,Referenceable> dataSets,Set<Referenceable> entities) throws AtlasHookException {
  try {
    if (entity.getType() == Type.TABLE || entity.getType() == Type.PARTITION) {
      final String tblQFName=HiveMetaStoreBridge.getTableQualifiedName(dgiBridge.getClusterName(),entity.getTable());
      if (!dataSetsProcessed.contains(tblQFName)) {
        LinkedHashMap<Type,Referenceable> result=createOrUpdateEntities(dgiBridge,event,entity,false);
        dataSets.put(entity,result.get(Type.TABLE));
        dataSetsProcessed.add(tblQFName);
        entities.addAll(result.values());
      }
    }
 else     if (entity.getType() == Type.DFS_DIR) {
      URI location=entity.getLocation();
      if (location != null) {
        final String pathUri=lower(new Path(location).toString());
        LOG.debug("String_Node_Str",pathUri);
        if (!dataSetsProcessed.contains(pathUri)) {
          Referenceable hdfsPath=dgiBridge.fillHDFSDataSet(pathUri);
          dataSets.put(entity,hdfsPath);
          dataSetsProcessed.add(pathUri);
          entities.add(hdfsPath);
        }
      }
    }
  }
 catch (  Exception e) {
    throw new AtlasHookException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
private <T extends Entity>void processHiveEntity(HiveMetaStoreBridge dgiBridge,HiveEventContext event,T entity,Set<String> dataSetsProcessed,SortedMap<T,Referenceable> dataSets,Set<Referenceable> entities) throws AtlasHookException {
  try {
    if (entity.getType() == Type.TABLE || entity.getType() == Type.PARTITION) {
      final String tblQFName=HiveMetaStoreBridge.getTableQualifiedName(dgiBridge.getClusterName(),entity.getTable());
      if (!dataSetsProcessed.contains(tblQFName)) {
        LinkedHashMap<Type,Referenceable> result=createOrUpdateEntities(dgiBridge,event,entity,false);
        if (result.get(Type.TABLE) != null) {
          dataSets.put(entity,result.get(Type.TABLE));
        }
        dataSetsProcessed.add(tblQFName);
        entities.addAll(result.values());
      }
    }
 else     if (entity.getType() == Type.DFS_DIR) {
      URI location=entity.getLocation();
      if (location != null) {
        final String pathUri=lower(new Path(location).toString());
        LOG.debug("String_Node_Str",pathUri);
        if (!dataSetsProcessed.contains(pathUri)) {
          Referenceable hdfsPath=dgiBridge.fillHDFSDataSet(pathUri);
          dataSets.put(entity,hdfsPath);
          dataSetsProcessed.add(pathUri);
          entities.add(hdfsPath);
        }
      }
    }
  }
 catch (  Exception e) {
    throw new AtlasHookException("String_Node_Str",e);
  }
}
Program: 171050
Project: 171050
Buggy source:
private static void addInputs(HiveMetaStoreBridge hiveBridge,HiveOperation op,SortedSet<ReadEntity> sortedInputs,StringBuilder buffer,final Map<ReadEntity,Referenceable> refs,final boolean ignoreHDFSPathsInQFName) throws HiveException {
  if (refs != null) {
    if (sortedInputs != null) {
      Set<String> dataSetsProcessed=new LinkedHashSet<>();
      for (      Entity input : sortedInputs) {
        if (!dataSetsProcessed.contains(input.getName().toLowerCase())) {
          if (ignoreHDFSPathsInQFName && (Type.DFS_DIR.equals(input.getType()) || Type.LOCAL_DIR.equals(input.getType()))) {
            LOG.debug("String_Node_Str",input.getName());
          }
 else           if (refs.containsKey(input)) {
            if (input.getType() == Type.PARTITION || input.getType() == Type.TABLE) {
              final Date createTime=HiveMetaStoreBridge.getTableCreatedTime(hiveBridge.hiveClient.getTable(input.getTable().getDbName(),input.getTable().getTableName()));
              addDataset(buffer,refs.get(input),createTime.getTime());
            }
 else {
              addDataset(buffer,refs.get(input));
            }
          }
          dataSetsProcessed.add(input.getName().toLowerCase());
        }
      }
    }
  }
}

Fixed version (ground truth):
private static void addInputs(HiveMetaStoreBridge hiveBridge,HiveOperation op,SortedSet<ReadEntity> sortedInputs,StringBuilder buffer,final Map<ReadEntity,Referenceable> refs,final boolean ignoreHDFSPathsInQFName) throws HiveException {
  if (refs != null) {
    if (sortedInputs != null) {
      Set<String> dataSetsProcessed=new LinkedHashSet<>();
      for (      Entity input : sortedInputs) {
        if (!dataSetsProcessed.contains(input.getName().toLowerCase())) {
          if (ignoreHDFSPathsInQFName && (Type.DFS_DIR.equals(input.getType()) || Type.LOCAL_DIR.equals(input.getType()))) {
            LOG.debug("String_Node_Str",input.getName());
          }
 else           if (refs.containsKey(input)) {
            if (input.getType() == Type.PARTITION || input.getType() == Type.TABLE) {
              Table inputTable=refreshTable(hiveBridge,input.getTable().getDbName(),input.getTable().getTableName());
              if (inputTable != null) {
                final Date createTime=HiveMetaStoreBridge.getTableCreatedTime(inputTable);
                addDataset(buffer,refs.get(input),createTime.getTime());
              }
            }
 else {
              addDataset(buffer,refs.get(input));
            }
          }
          dataSetsProcessed.add(input.getName().toLowerCase());
        }
      }
    }
  }
}
Program: 171051
Project: 171051
Buggy source:
private static void addOutputs(HiveMetaStoreBridge hiveBridge,HiveOperation op,SortedSet<WriteEntity> sortedOutputs,StringBuilder buffer,final Map<WriteEntity,Referenceable> refs,final boolean ignoreHDFSPathsInQFName) throws HiveException {
  if (refs != null) {
    Set<String> dataSetsProcessed=new LinkedHashSet<>();
    if (sortedOutputs != null) {
      for (      WriteEntity output : sortedOutputs) {
        final Entity entity=output;
        if (!dataSetsProcessed.contains(output.getName().toLowerCase())) {
          if (addQueryType(op,(WriteEntity)entity)) {
            buffer.append(SEP);
            buffer.append(((WriteEntity)entity).getWriteType().name());
          }
          if (ignoreHDFSPathsInQFName && (Type.DFS_DIR.equals(output.getType()) || Type.LOCAL_DIR.equals(output.getType()))) {
            LOG.debug("String_Node_Str",output.getName());
          }
 else           if (refs.containsKey(output)) {
            if (output.getType() == Type.PARTITION || output.getType() == Type.TABLE) {
              final Date createTime=HiveMetaStoreBridge.getTableCreatedTime(hiveBridge.hiveClient.getTable(output.getTable().getDbName(),output.getTable().getTableName()));
              addDataset(buffer,refs.get(output),createTime.getTime());
            }
 else {
              addDataset(buffer,refs.get(output));
            }
          }
          dataSetsProcessed.add(output.getName().toLowerCase());
        }
      }
    }
  }
}

Fixed version (ground truth):
private static void addOutputs(HiveMetaStoreBridge hiveBridge,HiveOperation op,SortedSet<WriteEntity> sortedOutputs,StringBuilder buffer,final Map<WriteEntity,Referenceable> refs,final boolean ignoreHDFSPathsInQFName) throws HiveException {
  if (refs != null) {
    Set<String> dataSetsProcessed=new LinkedHashSet<>();
    if (sortedOutputs != null) {
      for (      WriteEntity output : sortedOutputs) {
        final Entity entity=output;
        if (!dataSetsProcessed.contains(output.getName().toLowerCase())) {
          if (addQueryType(op,(WriteEntity)entity)) {
            buffer.append(SEP);
            buffer.append(((WriteEntity)entity).getWriteType().name());
          }
          if (ignoreHDFSPathsInQFName && (Type.DFS_DIR.equals(output.getType()) || Type.LOCAL_DIR.equals(output.getType()))) {
            LOG.debug("String_Node_Str",output.getName());
          }
 else           if (refs.containsKey(output)) {
            if (output.getType() == Type.PARTITION || output.getType() == Type.TABLE) {
              Table outputTable=refreshTable(hiveBridge,output.getTable().getDbName(),output.getTable().getTableName());
              if (outputTable != null) {
                final Date createTime=HiveMetaStoreBridge.getTableCreatedTime(outputTable);
                addDataset(buffer,refs.get(output),createTime.getTime());
              }
            }
 else {
              addDataset(buffer,refs.get(output));
            }
          }
          dataSetsProcessed.add(output.getName().toLowerCase());
        }
      }
    }
  }
}
Program: 171052
Project: 171052
Buggy source:
public void addEntity(EntityOperation op,AtlasEntityHeader header){
  if (mutatedEntities == null) {
    mutatedEntities=new HashMap<>();
  }
  List<AtlasEntityHeader> opEntities=mutatedEntities.get(op);
  if (opEntities == null) {
    opEntities=new ArrayList<>();
    mutatedEntities.put(op,opEntities);
  }
  opEntities.add(header);
}

Fixed version (ground truth):
public void addEntity(EntityOperation op,AtlasEntityHeader header){
  if (mutatedEntities == null) {
    mutatedEntities=new HashMap<>();
  }
  List<AtlasEntityHeader> opEntities=mutatedEntities.get(op);
  if (opEntities == null) {
    opEntities=new ArrayList<>();
    mutatedEntities.put(op,opEntities);
  }
  if (!entityHeaderExists(opEntities,header)) {
    opEntities.add(header);
  }
}
Program: 171054
Project: 171054
Buggy source:
private String assertEntityIsRegistered(final String typeName,final String property,final String value) throws Exception {
  waitFor(80000,new Predicate(){
    @Override public void evaluate() throws Exception {
      Referenceable entity=atlasClient.getEntity(typeName,property,value);
      assertNotNull(entity);
    }
  }
);
  Referenceable entity=atlasClient.getEntity(typeName,property,value);
  return entity.getId()._getId();
}

Fixed version (ground truth):
private String assertEntityIsRegistered(final String typeName,final String property,final String value) throws Exception {
  waitFor(1000,new Predicate(){
    @Override public void evaluate() throws Exception {
      Referenceable entity=atlasClient.getEntity(typeName,property,value);
      assertNotNull(entity);
    }
  }
);
  Referenceable entity=atlasClient.getEntity(typeName,property,value);
  return entity.getId()._getId();
}
Program: 171055
Project: 171055
Buggy source:
protected String assertEntityIsRegistered(final String typeName,final String property,final String value,final HiveHookIT.AssertPredicate assertPredicate) throws Exception {
  waitFor(80000,new HiveHookIT.Predicate(){
    @Override public void evaluate() throws Exception {
      Referenceable entity=atlasClient.getEntity(typeName,property,value);
      assertNotNull(entity);
      if (assertPredicate != null) {
        assertPredicate.assertOnEntity(entity);
      }
    }
  }
);
  Referenceable entity=atlasClient.getEntity(typeName,property,value);
  return entity.getId()._getId();
}

Fixed version (ground truth):
protected String assertEntityIsRegistered(final String typeName,final String property,final String value,final HiveHookIT.AssertPredicate assertPredicate) throws Exception {
  waitFor(1000,new HiveHookIT.Predicate(){
    @Override public void evaluate() throws Exception {
      Referenceable entity=atlasClient.getEntity(typeName,property,value);
      assertNotNull(entity);
      if (assertPredicate != null) {
        assertPredicate.assertOnEntity(entity);
      }
    }
  }
);
  Referenceable entity=atlasClient.getEntity(typeName,property,value);
  return entity.getId()._getId();
}
Program: 171056
Project: 171056
Buggy source:
private void assertEntityIsNotRegistered(final String typeName,final String property,final String value) throws Exception {
  waitFor(80000,new Predicate(){
    @Override public void evaluate() throws Exception {
      try {
        atlasClient.getEntity(typeName,property,value);
      }
 catch (      AtlasServiceException e) {
        if (e.getStatus() == ClientResponse.Status.NOT_FOUND) {
          return;
        }
      }
      fail(String.format("String_Node_Str" + "String_Node_Str",typeName,property,value));
    }
  }
);
}

Fixed version (ground truth):
private void assertEntityIsNotRegistered(final String typeName,final String property,final String value) throws Exception {
  waitFor(1000,new Predicate(){
    @Override public void evaluate() throws Exception {
      try {
        atlasClient.getEntity(typeName,property,value);
      }
 catch (      AtlasServiceException e) {
        if (e.getStatus() == ClientResponse.Status.NOT_FOUND) {
          return;
        }
      }
      fail(String.format("String_Node_Str" + "String_Node_Str",typeName,property,value));
    }
  }
);
}
Program: 171057
Project: 171057
Buggy source:
protected void configure(HttpSecurity httpSecurity) throws Exception {
  httpSecurity.authorizeRequests().anyRequest().authenticated().and().headers().disable().servletApi().and().csrf().disable().sessionManagement().enableSessionUrlRewriting(false).sessionCreationPolicy(SessionCreationPolicy.ALWAYS).sessionFixation().newSession().and().formLogin().loginPage("String_Node_Str").loginProcessingUrl("String_Node_Str").successHandler(successHandler).failureHandler(failureHandler).usernameParameter("String_Node_Str").passwordParameter("String_Node_Str").and().logout().logoutSuccessUrl("String_Node_Str").deleteCookies("String_Node_Str").logoutUrl("String_Node_Str").and().httpBasic().authenticationEntryPoint(getDelegatingAuthenticationEntryPoint());
  if (configuration.getBoolean("String_Node_Str",false)) {
    LOG.info("String_Node_Str");
    httpSecurity.addFilterAfter(activeServerFilter,BasicAuthenticationFilter.class);
  }
  httpSecurity.addFilterAfter(staleTransactionCleanupFilter,BasicAuthenticationFilter.class).addFilterAfter(ssoAuthenticationFilter,BasicAuthenticationFilter.class).addFilterAfter(atlasAuthenticationFilter,SecurityContextHolderAwareRequestFilter.class).addFilterAfter(csrfPreventionFilter,AtlasAuthenticationFilter.class).addFilterAfter(atlasAuthorizationFilter,FilterSecurityInterceptor.class);
}

Fixed version (ground truth):
protected void configure(HttpSecurity httpSecurity) throws Exception {
  httpSecurity.authorizeRequests().anyRequest().authenticated().and().headers().disable().servletApi().and().csrf().disable().sessionManagement().enableSessionUrlRewriting(false).sessionCreationPolicy(SessionCreationPolicy.ALWAYS).sessionFixation().newSession().and().httpBasic().authenticationEntryPoint(getDelegatingAuthenticationEntryPoint()).and().formLogin().loginPage("String_Node_Str").loginProcessingUrl("String_Node_Str").successHandler(successHandler).failureHandler(failureHandler).usernameParameter("String_Node_Str").passwordParameter("String_Node_Str").and().logout().logoutSuccessUrl("String_Node_Str").deleteCookies("String_Node_Str").logoutUrl("String_Node_Str");
  if (configuration.getBoolean("String_Node_Str",false)) {
    LOG.info("String_Node_Str");
    httpSecurity.addFilterAfter(activeServerFilter,BasicAuthenticationFilter.class);
  }
  httpSecurity.addFilterAfter(staleTransactionCleanupFilter,BasicAuthenticationFilter.class).addFilterAfter(ssoAuthenticationFilter,BasicAuthenticationFilter.class).addFilterAfter(atlasAuthenticationFilter,SecurityContextHolderAwareRequestFilter.class).addFilterAfter(csrfPreventionFilter,AtlasAuthenticationFilter.class).addFilterAfter(atlasAuthorizationFilter,FilterSecurityInterceptor.class);
}
Program: 171058
Project: 171058
Buggy source:
public AtlasRelationshipDef getRelationshipDef(AtlasVertex entityVertex,AtlasEntityType entityType,String attributeName){
  List<AtlasRelationshipType> relationshipTypes=entityType.getRelationshipAttributeType(attributeName);
  AtlasRelationshipDef ret=null;
  if (relationshipTypes.size() > 1) {
    Iterator<AtlasEdge> iter=entityVertex.getEdges(AtlasEdgeDirection.IN).iterator();
    while (iter.hasNext() && ret == null) {
      String edgeTypeName=AtlasGraphUtilsV1.getTypeName(iter.next());
      for (      AtlasRelationshipType relationType : relationshipTypes) {
        AtlasRelationshipDef relationshipDef=relationType.getRelationshipDef();
        if (StringUtils.equals(edgeTypeName,relationshipDef.getName())) {
          ret=relationshipDef;
          break;
        }
      }
    }
  }
 else {
    ret=relationshipTypes.get(0).getRelationshipDef();
  }
  return ret;
}

Fixed version (ground truth):
public AtlasRelationshipDef getRelationshipDef(AtlasVertex entityVertex,AtlasEntityType entityType,String attributeName){
  List<AtlasRelationshipType> relationshipTypes=entityType.getRelationshipAttributeType(attributeName);
  AtlasRelationshipDef ret=null;
  if (relationshipTypes.size() > 1) {
    Iterator<AtlasEdge> iter=entityVertex.getEdges(AtlasEdgeDirection.IN).iterator();
    while (iter.hasNext() && ret == null) {
      String edgeTypeName=AtlasGraphUtilsV1.getTypeName(iter.next());
      for (      AtlasRelationshipType relationType : relationshipTypes) {
        AtlasRelationshipDef relationshipDef=relationType.getRelationshipDef();
        if (StringUtils.equals(edgeTypeName,relationshipDef.getName())) {
          ret=relationshipDef;
          break;
        }
      }
    }
    if (ret == null) {
      ret=relationshipTypes.get(0).getRelationshipDef();
    }
  }
 else {
    ret=relationshipTypes.get(0).getRelationshipDef();
  }
  return ret;
}
Program: 171060
Project: 171060
Buggy source:
private AtlasEdge updateRelationship(AtlasEdge currentEdge,final AtlasVertex entityVertex) throws AtlasBaseException {
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str",AtlasGraphUtilsV1.getTypeName(entityVertex));
  }
  String currentEntityId=AtlasGraphUtilsV1.getIdFromVertex(currentEdge.getInVertex());
  String newEntityId=AtlasGraphUtilsV1.getIdFromVertex(entityVertex);
  AtlasEdge ret=currentEdge;
  if (!currentEntityId.equals(newEntityId) && entityVertex != null) {
    String relationshipName=AtlasGraphUtilsV1.getTypeName(currentEdge);
    if (relationshipName == null) {
      relationshipName=currentEdge.getLabel();
    }
    ret=getOrCreateRelationship(currentEdge.getOutVertex(),entityVertex,relationshipName);
  }
  return ret;
}

Fixed version (ground truth):
private AtlasEdge updateRelationship(AtlasEdge currentEdge,final AtlasVertex entityVertex) throws AtlasBaseException {
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str",AtlasGraphUtilsV1.getTypeName(entityVertex));
  }
  String currentEntityId=AtlasGraphUtilsV1.getIdFromVertex(currentEdge.getInVertex());
  String newEntityId=AtlasGraphUtilsV1.getIdFromVertex(entityVertex);
  AtlasEdge ret=currentEdge;
  if (!currentEntityId.equals(newEntityId)) {
    String relationshipName=AtlasGraphUtilsV1.getTypeName(currentEdge);
    if (relationshipName == null) {
      relationshipName=currentEdge.getLabel();
    }
    ret=getOrCreateRelationship(currentEdge.getOutVertex(),entityVertex,relationshipName);
  }
  return ret;
}
Program: 171063
Project: 171063
Buggy source:
/** 
 * Get an instance of the script engine to execute Gremlin queries
 * @return script engine to execute Gremlin queries
 */
ScriptEngine getGremlinScriptEngine();

Fixed version (ground truth):
/** 
 * Get an instance of the script engine to execute Gremlin queries
 * @return script engine to execute Gremlin queries
 */
ScriptEngine getGremlinScriptEngine() throws AtlasBaseException ;
Program: 171064
Project: 171064
Buggy source:
private Object executeGremlinScript(String gremlinQuery) throws ScriptException {
  Object result=null;
  ScriptEngine engine=getGremlinScriptEngine();
  try {
    Bindings bindings=engine.createBindings();
    bindings.put("String_Node_Str",getGraph());
    result=engine.eval(gremlinQuery,bindings);
  }
  finally {
    releaseGremlinScriptEngine(engine);
  }
  return result;
}

Fixed version (ground truth):
private Object executeGremlinScript(String gremlinQuery) throws AtlasBaseException {
  Object result=null;
  ScriptEngine engine=getGremlinScriptEngine();
  try {
    Bindings bindings=engine.createBindings();
    bindings.put("String_Node_Str",getGraph());
    result=engine.eval(gremlinQuery,bindings);
  }
 catch (  ScriptException e) {
    throw new AtlasBaseException(AtlasErrorCode.GREMLIN_SCRIPT_EXECUTION_FAILED,gremlinQuery);
  }
 finally {
    releaseGremlinScriptEngine(engine);
  }
  return result;
}
Program: 171065
Project: 171065
Buggy source:
@Override public ScriptEngine getGremlinScriptEngine(){
  ScriptEngineManager manager=new ScriptEngineManager();
  ScriptEngine engine=manager.getEngineByName("String_Node_Str");
  if (engine != null) {
    engine.getContext().setAttribute("String_Node_Str","String_Node_Str",ScriptContext.ENGINE_SCOPE);
  }
  return engine;
}

Fixed version (ground truth):
@Override public ScriptEngine getGremlinScriptEngine() throws AtlasBaseException {
  ScriptEngineManager manager=new ScriptEngineManager();
  ScriptEngine engine=manager.getEngineByName("String_Node_Str");
  if (engine == null) {
    throw new AtlasBaseException(AtlasErrorCode.FAILED_TO_OBTAIN_GREMLIN_SCRIPT_ENGINE,"String_Node_Str");
  }
  engine.getContext().setAttribute("String_Node_Str","String_Node_Str",ScriptContext.ENGINE_SCOPE);
  return engine;
}
Program: 171068
Project: 171068
Buggy source:
/** 
 * Assumes the User is familiar with the persistence structure of the Repository. The given query is run uninterpreted against the underlying Graph Store. The results are returned as a List of Rows. each row is a Map of Key,Value pairs.
 * @param gremlinQuery query in gremlin dsl format
 * @return List of Maps
 * @throws org.apache.atlas.discovery.DiscoveryException
 */
@Override @GraphTransaction public List<Map<String,String>> searchByGremlin(String gremlinQuery) throws DiscoveryException {
  LOG.debug("String_Node_Str",gremlinQuery);
  try {
    Object o=graph.executeGremlinScript(gremlinQuery,false);
    return extractResult(o);
  }
 catch (  ScriptException se) {
    throw new DiscoveryException(se);
  }
}

Fixed version (ground truth):
/** 
 * Assumes the User is familiar with the persistence structure of the Repository. The given query is run uninterpreted against the underlying Graph Store. The results are returned as a List of Rows. each row is a Map of Key,Value pairs.
 * @param gremlinQuery query in gremlin dsl format
 * @return List of Maps
 * @throws org.apache.atlas.discovery.DiscoveryException
 */
@Override @GraphTransaction public List<Map<String,String>> searchByGremlin(String gremlinQuery) throws DiscoveryException {
  LOG.debug("String_Node_Str",gremlinQuery);
  try {
    Object o=graph.executeGremlinScript(gremlinQuery,false);
    return extractResult(o);
  }
 catch (  AtlasBaseException e) {
    throw new DiscoveryException(e);
  }
}
Program: 171069
Project: 171069
Buggy source:
private void executeGremlinQuery(AtlasMetrics metrics,String type,String name,String query) throws ScriptException {
  Object result=atlasGraph.executeGremlinScript(query,false);
  if (result instanceof Number) {
    metrics.addData(type,name,((Number)result).intValue());
  }
 else   if (result instanceof List) {
    for (    Map<String,Number> resultMap : (List<Map<String,Number>>)result) {
      for (      Map.Entry<String,Number> entry : resultMap.entrySet()) {
        metrics.addData(type,entry.getKey(),entry.getValue().intValue());
      }
    }
  }
 else {
    String returnClassName=result != null ? result.getClass().getSimpleName() : "String_Node_Str";
    LOG.warn("String_Node_Str",returnClassName,query);
  }
}

Fixed version (ground truth):
private void executeGremlinQuery(AtlasMetrics metrics,String type,String name,String query) throws AtlasBaseException {
  Object result=atlasGraph.executeGremlinScript(query,false);
  if (result instanceof Number) {
    metrics.addData(type,name,((Number)result).intValue());
  }
 else   if (result instanceof List) {
    for (    Map<String,Number> resultMap : (List<Map<String,Number>>)result) {
      for (      Map.Entry<String,Number> entry : resultMap.entrySet()) {
        metrics.addData(type,entry.getKey(),entry.getValue().intValue());
      }
    }
  }
 else {
    String returnClassName=result != null ? result.getClass().getSimpleName() : "String_Node_Str";
    LOG.warn("String_Node_Str",returnClassName,query);
  }
}
Program: 171070
Project: 171070
Buggy source:
@SuppressWarnings("String_Node_Str") public AtlasMetrics getMetrics(boolean ignoreCache){
  if (ignoreCache || !isCacheValid()) {
    AtlasMetrics metrics=new AtlasMetrics();
    for (    MetricQuery metricQuery : MetricQuery.values()) {
      try {
        if (LOG.isDebugEnabled()) {
          LOG.debug("String_Node_Str",metricQuery);
        }
        executeGremlinQuery(metrics,metricQuery.group,metricQuery.name,metricQuery.query);
      }
 catch (      ScriptException e) {
        if (LOG.isDebugEnabled()) {
          LOG.debug("String_Node_Str",metricQuery,e);
        }
 else {
          LOG.warn("String_Node_Str",metricQuery);
        }
      }
    }
    long collectionTime=System.currentTimeMillis();
    metrics.addData(GENERAL,METRIC_COLLECTION_TIME,collectionTime);
    this.cachedMetrics=metrics;
    this.cacheExpirationTime=(collectionTime + cacheTTLInSecs * 1000);
  }
  return cachedMetrics;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public AtlasMetrics getMetrics(boolean ignoreCache){
  if (ignoreCache || !isCacheValid()) {
    AtlasMetrics metrics=new AtlasMetrics();
    for (    MetricQuery metricQuery : MetricQuery.values()) {
      try {
        if (LOG.isDebugEnabled()) {
          LOG.debug("String_Node_Str",metricQuery);
        }
        executeGremlinQuery(metrics,metricQuery.group,metricQuery.name,metricQuery.query);
      }
 catch (      AtlasBaseException e) {
        if (LOG.isDebugEnabled()) {
          LOG.debug("String_Node_Str",metricQuery,e);
        }
 else {
          LOG.warn("String_Node_Str",metricQuery);
        }
      }
    }
    long collectionTime=System.currentTimeMillis();
    metrics.addData(GENERAL,METRIC_COLLECTION_TIME,collectionTime);
    this.cachedMetrics=metrics;
    this.cacheExpirationTime=(collectionTime + cacheTTLInSecs * 1000);
  }
  return cachedMetrics;
}
Program: 171071
Project: 171071
Buggy source:
@BeforeClass public void init() throws ScriptException {
  Map<String,Object> mockMap=new HashMap<>();
  mockMap.put("String_Node_Str",1);
  mockMap.put("String_Node_Str",2);
  mockMap.put("String_Node_Str",3);
  mockMapList.add(mockMap);
  when(mockConfig.getInt(anyString(),anyInt())).thenReturn(5);
  assertEquals(mockConfig.getInt("String_Node_Str",1),5);
  when(mockConfig.getString(anyString(),anyString())).thenReturn("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  when(mockTypeRegistry.getAllEntityDefNames()).thenReturn(Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str"));
  setupMockGraph();
  metricsService=new MetricsService(mockConfig,mockGraph);
}

Fixed version (ground truth):
@BeforeClass public void init() throws AtlasBaseException {
  Map<String,Object> mockMap=new HashMap<>();
  mockMap.put("String_Node_Str",1);
  mockMap.put("String_Node_Str",2);
  mockMap.put("String_Node_Str",3);
  mockMapList.add(mockMap);
  when(mockConfig.getInt(anyString(),anyInt())).thenReturn(5);
  assertEquals(mockConfig.getInt("String_Node_Str",1),5);
  when(mockConfig.getString(anyString(),anyString())).thenReturn("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  when(mockTypeRegistry.getAllEntityDefNames()).thenReturn(Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str"));
  setupMockGraph();
  metricsService=new MetricsService(mockConfig,mockGraph);
}
Program: 171072
Project: 171072
Buggy source:
@Test public void testGetMetrics() throws InterruptedException, ScriptException {
  assertNotNull(metricsService);
  AtlasMetrics metrics=metricsService.getMetrics(false);
  assertNotNull(metrics);
  Number aCount=metrics.getMetric("String_Node_Str","String_Node_Str");
  assertNotNull(aCount);
  assertEquals(aCount,1);
  Number bCount=metrics.getMetric("String_Node_Str","String_Node_Str");
  assertNotNull(bCount);
  assertEquals(bCount,2);
  Number cCount=metrics.getMetric("String_Node_Str","String_Node_Str");
  assertNotNull(cCount);
  assertEquals(cCount,3);
  Number aTags=metrics.getMetric("String_Node_Str","String_Node_Str");
  assertNotNull(aTags);
  assertEquals(aTags,1);
  Number bTags=metrics.getMetric("String_Node_Str","String_Node_Str");
  assertNotNull(bTags);
  assertEquals(bTags,2);
  Number cTags=metrics.getMetric("String_Node_Str","String_Node_Str");
  assertNotNull(cTags);
  assertEquals(cTags,3);
  verify(mockGraph,atLeastOnce()).executeGremlinScript(anyString(),anyBoolean());
  metricsService.getMetrics(false);
  verifyZeroInteractions(mockGraph);
  Thread.sleep(6000);
  metricsService.getMetrics(true);
  verify(mockGraph,atLeastOnce()).executeGremlinScript(anyString(),anyBoolean());
}

Fixed version (ground truth):
@Test public void testGetMetrics() throws InterruptedException, AtlasBaseException {
  assertNotNull(metricsService);
  AtlasMetrics metrics=metricsService.getMetrics(false);
  assertNotNull(metrics);
  Number aCount=metrics.getMetric("String_Node_Str","String_Node_Str");
  assertNotNull(aCount);
  assertEquals(aCount,1);
  Number bCount=metrics.getMetric("String_Node_Str","String_Node_Str");
  assertNotNull(bCount);
  assertEquals(bCount,2);
  Number cCount=metrics.getMetric("String_Node_Str","String_Node_Str");
  assertNotNull(cCount);
  assertEquals(cCount,3);
  Number aTags=metrics.getMetric("String_Node_Str","String_Node_Str");
  assertNotNull(aTags);
  assertEquals(aTags,1);
  Number bTags=metrics.getMetric("String_Node_Str","String_Node_Str");
  assertNotNull(bTags);
  assertEquals(bTags,2);
  Number cTags=metrics.getMetric("String_Node_Str","String_Node_Str");
  assertNotNull(cTags);
  assertEquals(cTags,3);
  verify(mockGraph,atLeastOnce()).executeGremlinScript(anyString(),anyBoolean());
  metricsService.getMetrics(false);
  verifyZeroInteractions(mockGraph);
  Thread.sleep(6000);
  metricsService.getMetrics(true);
  verify(mockGraph,atLeastOnce()).executeGremlinScript(anyString(),anyBoolean());
}
Program: 171073
Project: 171073
Buggy source:
private void setupMockGraph() throws ScriptException {
  if (mockGraph == null)   mockGraph=mock(AtlasGraph.class);
  when(mockGraph.executeGremlinScript(anyString(),eq(false))).thenAnswer(new Answer<Object>(){
    @Override public Object answer(    InvocationOnMock invocationOnMock) throws Throwable {
      if (((String)invocationOnMock.getArguments()[0]).contains("String_Node_Str")) {
        return mockCount;
      }
 else {
        return mockMapList;
      }
    }
  }
);
}

Fixed version (ground truth):
private void setupMockGraph() throws AtlasBaseException {
  if (mockGraph == null)   mockGraph=mock(AtlasGraph.class);
  when(mockGraph.executeGremlinScript(anyString(),eq(false))).thenAnswer(new Answer<Object>(){
    @Override public Object answer(    InvocationOnMock invocationOnMock) throws Throwable {
      if (((String)invocationOnMock.getArguments()[0]).contains("String_Node_Str")) {
        return mockCount;
      }
 else {
        return mockMapList;
      }
    }
  }
);
}
Program: 171074
Project: 171074
Buggy source:
private void updateFullTextMapping(String entityId,List<AtlasClassification> classifications){
  try {
    if (!AtlasRepositoryConfiguration.isFullTextSearchEnabled()) {
      return;
    }
  }
 catch (  AtlasException e) {
    LOG.warn("String_Node_Str");
  }
  if (StringUtils.isEmpty(entityId) || CollectionUtils.isEmpty(classifications)) {
    return;
  }
  AtlasVertex atlasVertex=AtlasGraphUtilsV1.findByGuid(entityId);
  try {
    String classificationFullText=fullTextMapperV2.getIndexTextForClassifications(entityId,classifications);
    String existingFullText=(String)GraphHelper.getProperty(atlasVertex,Constants.ENTITY_TEXT_PROPERTY_KEY);
    String newFullText=existingFullText + "String_Node_Str" + classificationFullText;
    GraphHelper.setProperty(atlasVertex,Constants.ENTITY_TEXT_PROPERTY_KEY,newFullText);
  }
 catch (  AtlasBaseException e) {
    LOG.error("String_Node_Str",entityId,e);
  }
}

Fixed version (ground truth):
private void updateFullTextMapping(String entityId,List<AtlasClassification> classifications){
  try {
    if (!AtlasRepositoryConfiguration.isFullTextSearchEnabled()) {
      return;
    }
  }
 catch (  AtlasException e) {
    LOG.warn("String_Node_Str");
  }
  if (StringUtils.isEmpty(entityId) || CollectionUtils.isEmpty(classifications)) {
    return;
  }
  AtlasVertex atlasVertex=AtlasGraphUtilsV1.findByGuid(entityId);
  if (atlasVertex == null) {
    LOG.warn("String_Node_Str",entityId);
    return;
  }
  try {
    String classificationFullText=fullTextMapperV2.getIndexTextForClassifications(entityId,classifications);
    String existingFullText=(String)GraphHelper.getProperty(atlasVertex,Constants.ENTITY_TEXT_PROPERTY_KEY);
    String newFullText=existingFullText + "String_Node_Str" + classificationFullText;
    GraphHelper.setProperty(atlasVertex,Constants.ENTITY_TEXT_PROPERTY_KEY,newFullText);
  }
 catch (  AtlasBaseException e) {
    LOG.error("String_Node_Str",entityId,e);
  }
}