Program: 131963
Project: 131963
Buggy source:
@Override public Object executeTransform(final Object input){
  Object joinValue=((ODocument)input).field(joinFieldName);
  if (joinValue != null) {
    Object result=null;
    if (sqlQuery == null && index == null) {
      if (lookup.toUpperCase().startsWith("String_Node_Str"))       sqlQuery=new OSQLSynchQuery<ODocument>(lookup);
 else       index=db.getMetadata().getIndexManager().getIndex(lookup);
    }
    if (sqlQuery != null)     result=db.query(sqlQuery,joinValue);
 else {
      final OType idxFieldType=index.getDefinition().getTypes()[0];
      joinValue=idxFieldType.convert(joinValue,idxFieldType.getDefaultJavaType());
      result=index.get(joinValue);
    }
    if (result != null) {
      if (linkFieldType != null) {
        if (linkFieldType == OType.LINK) {
          if (result instanceof Collection<?>) {
            if (!((Collection)result).isEmpty())             result=((Collection)result).iterator().next();
 else             result=null;
          }
        }
 else         if (linkFieldType == OType.LINKSET) {
          if (!(result instanceof Collection)) {
            final Set<OIdentifiable> res=new HashSet<OIdentifiable>();
            res.add((OIdentifiable)result);
            result=res;
          }
        }
 else         if (linkFieldType == OType.LINKLIST) {
          if (!(result instanceof Collection)) {
            final List<OIdentifiable> res=new ArrayList<OIdentifiable>();
            res.add((OIdentifiable)result);
            result=res;
          }
        }
      }
    }
    if (result == null) {
switch (unresolvedLinkAction) {
case CREATE:
        if (lookup != null) {
          final String[] lookupParts=lookup.split("String_Node_Str");
          final ODocument linkedDoc=new ODocument(lookupParts[0]);
          linkedDoc.field(lookupParts[1],joinValue);
          linkedDoc.save();
          result=linkedDoc;
        }
 else         throw new OConfigurationException("String_Node_Str");
      break;
case ERROR:
    processor.getStats().incrementErrors();
  processor.out(true,"String_Node_Str",getName(),joinValue);
break;
case WARNING:
processor.getStats().incrementWarnings();
processor.out(true,"String_Node_Str",getName(),joinValue);
break;
case SKIP:
return null;
case HALT:
throw new OETLProcessHaltedException("String_Node_Str" + joinValue + "String_Node_Str");
}
}
 else ((ODocument)input).field(linkFieldName,result);
}
return input;
}

Fixed version (ground truth):
@Override public Object executeTransform(final Object input){
  Object joinRuntimeValue=null;
  if (joinFieldName != null)   joinRuntimeValue=((ODocument)input).field(joinFieldName);
 else   if (joinValue != null)   joinRuntimeValue=resolve(joinValue);
  if (joinRuntimeValue != null) {
    Object result=null;
    if (sqlQuery == null && index == null) {
      if (lookup.toUpperCase().startsWith("String_Node_Str"))       sqlQuery=new OSQLSynchQuery<ODocument>(lookup);
 else       index=db.getMetadata().getIndexManager().getIndex(lookup);
    }
    if (sqlQuery != null)     result=db.query(sqlQuery,joinRuntimeValue);
 else {
      final OType idxFieldType=index.getDefinition().getTypes()[0];
      joinRuntimeValue=idxFieldType.convert(joinRuntimeValue,idxFieldType.getDefaultJavaType());
      result=index.get(joinRuntimeValue);
    }
    if (result != null) {
      if (linkFieldType != null) {
        if (linkFieldType == OType.LINK) {
          if (result instanceof Collection<?>) {
            if (!((Collection)result).isEmpty())             result=((Collection)result).iterator().next();
 else             result=null;
          }
        }
 else         if (linkFieldType == OType.LINKSET) {
          if (!(result instanceof Collection)) {
            final Set<OIdentifiable> res=new HashSet<OIdentifiable>();
            res.add((OIdentifiable)result);
            result=res;
          }
        }
 else         if (linkFieldType == OType.LINKLIST) {
          if (!(result instanceof Collection)) {
            final List<OIdentifiable> res=new ArrayList<OIdentifiable>();
            res.add((OIdentifiable)result);
            result=res;
          }
        }
      }
    }
    if (result == null) {
switch (unresolvedLinkAction) {
case CREATE:
        if (lookup != null) {
          final String[] lookupParts=lookup.split("String_Node_Str");
          final ODocument linkedDoc=new ODocument(lookupParts[0]);
          linkedDoc.field(lookupParts[1],joinRuntimeValue);
          linkedDoc.save();
          result=linkedDoc;
        }
 else         throw new OConfigurationException("String_Node_Str");
      break;
case ERROR:
    processor.getStats().incrementErrors();
  processor.out(true,"String_Node_Str",getName(),joinRuntimeValue);
break;
case WARNING:
processor.getStats().incrementWarnings();
processor.out(true,"String_Node_Str",getName(),joinRuntimeValue);
break;
case SKIP:
return null;
case HALT:
throw new OETLProcessHaltedException("String_Node_Str" + joinRuntimeValue + "String_Node_Str");
}
}
 else ((ODocument)input).field(linkFieldName,result);
}
return input;
}