Program: 131904
Project: 131904
Buggy source:
protected synchronized ODatabaseDocumentTx init(){
  ODatabaseDocumentTx documentDatabase=pipeline.getDocumentDatabase();
  OrientBaseGraph graphDatabase;
  if (documentDatabase == null) {
switch (dbType) {
case DOCUMENT:
      documentDatabase=new ODatabaseDocumentTx(dbURL);
    documentDatabase.open(dbUser,dbPassword);
  break;
case GRAPH:
final OrientGraphFactory factory=new OrientGraphFactory(dbURL);
graphDatabase=factory.getNoTx();
documentDatabase=graphDatabase.getRawGraph();
pipeline.setGraphDatabase(graphDatabase);
break;
}
pipeline.setDocumentDatabase(documentDatabase);
}
 else ODatabaseRecordThreadLocal.INSTANCE.set(documentDatabase);
if (className != null) {
schemaClass=getOrCreateClass(className,null);
log(OETLProcessor.LOG_LEVELS.DEBUG,"String_Node_Str",getName(),schemaClass.count(),getUnit(),className);
}
if (classes != null) {
for (ODocument cls : classes) {
schemaClass=getOrCreateClass((String)cls.field("String_Node_Str"),(String)cls.field("String_Node_Str"));
log(OETLProcessor.LOG_LEVELS.DEBUG,"String_Node_Str",getName(),schemaClass.count(),getUnit(),className);
}
}
if (indexes != null) {
for (ODocument idx : indexes) {
OIndex index;
String idxName=(String)resolve(idx.field("String_Node_Str"));
if (idxName != null) {
index=documentDatabase.getMetadata().getIndexManager().getIndex(idxName);
if (index != null) continue;
}
final String idxClass=(String)resolve(idx.field("String_Node_Str"));
if (idxClass == null) throw new OConfigurationException("String_Node_Str");
final OClass cls=getOrCreateClass(idxClass,null);
final String idxType=idx.field("String_Node_Str");
if (idxType == null) throw new OConfigurationException("String_Node_Str" + idxName + "String_Node_Str");
final List<String> idxFields=idx.field("String_Node_Str");
if (idxFields == null) throw new OConfigurationException("String_Node_Str");
String[] fields=new String[idxFields.size()];
for (int f=0; f < fields.length; ++f) {
final String fieldName=idxFields.get(f);
final String[] fieldNameParts=fieldName.split("String_Node_Str");
if (!cls.existsProperty(fieldNameParts[0])) {
if (fieldNameParts.length < 2) throw new OConfigurationException("String_Node_Str" + fieldName + "String_Node_Str");
final String fieldType=fieldNameParts[1].toUpperCase();
final OType type=OType.valueOf(fieldType);
cls.createProperty(fieldNameParts[0],type);
log(OETLProcessor.LOG_LEVELS.DEBUG,"String_Node_Str",idxClass,fieldNameParts[0],fieldNameParts[1]);
}
fields[f]=fieldNameParts[0];
}
if (idxName == null) {
idxName=idxClass + "String_Node_Str";
for (int i=0; i < fields.length; ++i) {
if (i > 0) idxName+='_';
idxName+=fields[i];
}
}
index=documentDatabase.getMetadata().getIndexManager().getIndex(idxName);
if (index != null) continue;
index=cls.createIndex(idxName,idxType,fields);
log(OETLProcessor.LOG_LEVELS.DEBUG,"String_Node_Str",idxName,idxType,idxClass,idxFields);
}
}
return documentDatabase;
}

Fixed version (ground truth):
protected synchronized ODatabaseDocumentTx init(){
  ODatabaseDocumentTx documentDatabase=pipeline.getDocumentDatabase();
  OrientBaseGraph graphDatabase;
  if (documentDatabase == null) {
switch (dbType) {
case DOCUMENT:
      documentDatabase=new ODatabaseDocumentTx(dbURL);
    documentDatabase.open(dbUser,dbPassword);
  break;
case GRAPH:
final OrientGraphFactory factory=new OrientGraphFactory(dbURL);
graphDatabase=factory.getNoTx();
graphDatabase.setUseLightweightEdges(useLightweightEdges);
pipeline.setGraphDatabase(graphDatabase);
documentDatabase=graphDatabase.getRawGraph();
break;
}
pipeline.setDocumentDatabase(documentDatabase);
}
 else ODatabaseRecordThreadLocal.INSTANCE.set(documentDatabase);
if (className != null) {
schemaClass=getOrCreateClass(className,null);
log(OETLProcessor.LOG_LEVELS.DEBUG,"String_Node_Str",getName(),schemaClass.count(),getUnit(),className);
}
if (classes != null) {
for (ODocument cls : classes) {
schemaClass=getOrCreateClass((String)cls.field("String_Node_Str"),(String)cls.field("String_Node_Str"));
log(OETLProcessor.LOG_LEVELS.DEBUG,"String_Node_Str",getName(),schemaClass.count(),getUnit(),className);
}
}
if (indexes != null) {
for (ODocument idx : indexes) {
OIndex index;
String idxName=(String)resolve(idx.field("String_Node_Str"));
if (idxName != null) {
index=documentDatabase.getMetadata().getIndexManager().getIndex(idxName);
if (index != null) continue;
}
final String idxClass=(String)resolve(idx.field("String_Node_Str"));
if (idxClass == null) throw new OConfigurationException("String_Node_Str");
final OClass cls=getOrCreateClass(idxClass,null);
final String idxType=idx.field("String_Node_Str");
if (idxType == null) throw new OConfigurationException("String_Node_Str" + idxName + "String_Node_Str");
final List<String> idxFields=idx.field("String_Node_Str");
if (idxFields == null) throw new OConfigurationException("String_Node_Str");
String[] fields=new String[idxFields.size()];
for (int f=0; f < fields.length; ++f) {
final String fieldName=idxFields.get(f);
final String[] fieldNameParts=fieldName.split("String_Node_Str");
if (!cls.existsProperty(fieldNameParts[0])) {
if (fieldNameParts.length < 2) throw new OConfigurationException("String_Node_Str" + fieldName + "String_Node_Str");
final String fieldType=fieldNameParts[1].toUpperCase();
final OType type=OType.valueOf(fieldType);
cls.createProperty(fieldNameParts[0],type);
log(OETLProcessor.LOG_LEVELS.DEBUG,"String_Node_Str",idxClass,fieldNameParts[0],fieldNameParts[1]);
}
fields[f]=fieldNameParts[0];
}
if (idxName == null) {
idxName=idxClass + "String_Node_Str";
for (int i=0; i < fields.length; ++i) {
if (i > 0) idxName+='_';
idxName+=fields[i];
}
}
index=documentDatabase.getMetadata().getIndexManager().getIndex(idxName);
if (index != null) continue;
index=cls.createIndex(idxName,idxType,fields);
log(OETLProcessor.LOG_LEVELS.DEBUG,"String_Node_Str",idxName,idxType,idxClass,idxFields);
}
}
return documentDatabase;
}