Program: 171066
Project: 171066
Buggy source:
@Override public AtlasSearchResult searchUsingDslQuery(String dslQuery,int limit,int offset) throws AtlasBaseException {
  AtlasSearchResult ret=new AtlasSearchResult(dslQuery,AtlasQueryType.DSL);
  GremlinQuery gremlinQuery=toGremlinQuery(dslQuery,limit,offset);
  try {
    if (LOG.isDebugEnabled()) {
      LOG.debug("String_Node_Str",dslQuery);
    }
    Object result=graph.executeGremlinScript(gremlinQuery.queryStr(),false);
    if (result instanceof List && CollectionUtils.isNotEmpty((List)result)) {
      List queryResult=(List)result;
      Object firstElement=queryResult.get(0);
      if (firstElement instanceof AtlasVertex) {
        for (        Object element : queryResult) {
          if (element instanceof AtlasVertex) {
            ret.addEntity(entityRetriever.toAtlasEntityHeader((AtlasVertex)element));
          }
 else {
            LOG.warn("String_Node_Str",dslQuery,element);
          }
        }
      }
 else       if (firstElement instanceof Map && (((Map)firstElement).containsKey("String_Node_Str") || ((Map)firstElement).containsKey("String_Node_Str"))) {
        for (        Object element : queryResult) {
          if (element instanceof Map) {
            Map map=(Map)element;
            if (map.containsKey("String_Node_Str")) {
              Object value=map.get("String_Node_Str");
              if (value instanceof List && CollectionUtils.isNotEmpty((List)value)) {
                Object entry=((List)value).get(0);
                if (entry instanceof AtlasVertex) {
                  ret.addEntity(entityRetriever.toAtlasEntityHeader((AtlasVertex)entry));
                }
              }
            }
          }
 else {
            LOG.warn("String_Node_Str",dslQuery,element);
          }
        }
      }
 else       if (gremlinQuery.hasSelectList()) {
        ret.setAttributes(toAttributesResult(queryResult,gremlinQuery));
      }
    }
  }
 catch (  ScriptException e) {
    throw new AtlasBaseException(DISCOVERY_QUERY_FAILED,gremlinQuery.queryStr());
  }
  return ret;
}

Fixed version (ground truth):
@Override public AtlasSearchResult searchUsingDslQuery(String dslQuery,int limit,int offset) throws AtlasBaseException {
  AtlasSearchResult ret=new AtlasSearchResult(dslQuery,AtlasQueryType.DSL);
  GremlinQuery gremlinQuery=toGremlinQuery(dslQuery,limit,offset);
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str",dslQuery);
  }
  Object result=graph.executeGremlinScript(gremlinQuery.queryStr(),false);
  if (result instanceof List && CollectionUtils.isNotEmpty((List)result)) {
    List queryResult=(List)result;
    Object firstElement=queryResult.get(0);
    if (firstElement instanceof AtlasVertex) {
      for (      Object element : queryResult) {
        if (element instanceof AtlasVertex) {
          ret.addEntity(entityRetriever.toAtlasEntityHeader((AtlasVertex)element));
        }
 else {
          LOG.warn("String_Node_Str",dslQuery,element);
        }
      }
    }
 else     if (firstElement instanceof Map && (((Map)firstElement).containsKey("String_Node_Str") || ((Map)firstElement).containsKey("String_Node_Str"))) {
      for (      Object element : queryResult) {
        if (element instanceof Map) {
          Map map=(Map)element;
          if (map.containsKey("String_Node_Str")) {
            Object value=map.get("String_Node_Str");
            if (value instanceof List && CollectionUtils.isNotEmpty((List)value)) {
              Object entry=((List)value).get(0);
              if (entry instanceof AtlasVertex) {
                ret.addEntity(entityRetriever.toAtlasEntityHeader((AtlasVertex)entry));
              }
            }
          }
        }
 else {
          LOG.warn("String_Node_Str",dslQuery,element);
        }
      }
    }
 else     if (gremlinQuery.hasSelectList()) {
      ret.setAttributes(toAttributesResult(queryResult,gremlinQuery));
    }
  }
  return ret;
}