Program: 131856
Project: 131856
Buggy source:
protected Object lookup(Object joinValue,final boolean iReturnRIDS){
  Object result=null;
  if (joinValue != null) {
    if (sqlQuery == null && index == null) {
      if (lookup.toUpperCase().startsWith("String_Node_Str"))       sqlQuery=new OSQLSynchQuery<ODocument>(lookup);
 else {
        index=pipeline.getDocumentDatabase().getMetadata().getIndexManager().getIndex(lookup);
        if (index == null) {
          log(OETLProcessor.LOG_LEVELS.DEBUG,"String_Node_Str",lookup);
          final String[] parts=lookup.split("String_Node_Str");
          sqlQuery=new OSQLSynchQuery<ODocument>("String_Node_Str" + parts[0] + "String_Node_Str"+ parts[1]+ "String_Node_Str");
        }
      }
    }
    if (index != null) {
      final OType idxFieldType=index.getDefinition().getTypes()[0];
      joinValue=OType.convert(joinValue,idxFieldType.getDefaultJavaType());
      result=index.get(joinValue);
    }
 else     result=pipeline.getDocumentDatabase().query(sqlQuery,joinValue);
    if (result != null && result instanceof Collection) {
      final Collection coll=(Collection)result;
      if (!coll.isEmpty()) {
        if (iReturnRIDS) {
          final List<ORID> resultRIDs=new ArrayList<ORID>(coll.size());
          for (          Object o : coll) {
            if (o instanceof OIdentifiable)             resultRIDs.add(((OIdentifiable)o).getIdentity());
          }
          result=resultRIDs;
        }
      }
 else       result=null;
    }
 else     if (result instanceof OIdentifiable) {
      if (iReturnRIDS)       result=((OIdentifiable)result).getIdentity();
 else       result=((OIdentifiable)result).getRecord();
    }
  }
  return result;
}

Fixed version (ground truth):
protected Object lookup(Object joinValue,final boolean iReturnRIDS){
  Object result=null;
  if (joinValue != null) {
    if (sqlQuery == null && index == null) {
      if (lookup.toUpperCase().startsWith("String_Node_Str"))       sqlQuery=new OSQLSynchQuery<ODocument>(lookup);
 else {
        index=pipeline.getDocumentDatabase().getMetadata().getIndexManager().getIndex(lookup);
        if (index == null) {
          log(OETLProcessor.LOG_LEVELS.DEBUG,"String_Node_Str",lookup);
          final String[] parts=lookup.split("String_Node_Str");
          sqlQuery=new OSQLSynchQuery<ODocument>("String_Node_Str" + parts[0] + "String_Node_Str"+ parts[1]+ "String_Node_Str");
        }
      }
    }
    if (index != null) {
      final OType idxFieldType=index.getDefinition().getTypes()[0];
      joinValue=OType.convert(joinValue,idxFieldType.getDefaultJavaType());
      result=index.get(joinValue);
    }
 else {
      if (sqlQuery instanceof OSQLSynchQuery)       ((OSQLSynchQuery)sqlQuery).resetPagination();
      result=pipeline.getDocumentDatabase().query(sqlQuery,joinValue);
    }
    if (result != null && result instanceof Collection) {
      final Collection coll=(Collection)result;
      if (!coll.isEmpty()) {
        if (iReturnRIDS) {
          final List<ORID> resultRIDs=new ArrayList<ORID>(coll.size());
          for (          Object o : coll) {
            if (o instanceof OIdentifiable)             resultRIDs.add(((OIdentifiable)o).getIdentity());
          }
          result=resultRIDs;
        }
      }
 else       result=null;
    }
 else     if (result instanceof OIdentifiable) {
      if (iReturnRIDS)       result=((OIdentifiable)result).getIdentity();
 else       result=((OIdentifiable)result).getRecord();
    }
  }
  return result;
}