Program: 131931
Project: 131931
Buggy source:
public void load(final Object input,OCommandContext context){
  if (input == null)   return;
  if (dbAutoCreateProperties) {
    if (dbType == DB_TYPE.DOCUMENT) {
      if (input instanceof ODocument) {
        final ODocument doc=(ODocument)input;
        final ODatabaseDocumentTx documentDatabase=pipeline.getDocumentDatabase();
        final OClass cls;
        if (className != null)         cls=getOrCreateClass(className,null);
 else         cls=doc.getSchemaClass();
        for (        String f : doc.fieldNames()) {
          final String newName=transformFieldName(f);
          final String fName=newName != null ? newName : f;
          OProperty p=cls.getProperty(fName);
          if (p == null) {
            final Object fValue=doc.field(f);
            createProperty(cls,fName,fValue);
            if (newName != null) {
              doc.removeField(f);
              doc.field(newName,fValue);
            }
          }
        }
      }
    }
 else     if (dbType == DB_TYPE.GRAPH) {
      if (input instanceof OrientElement) {
        final OrientElement element=(OrientElement)input;
        final OrientBaseGraph graph=pipeline.getGraphDatabase();
        final OClass cls;
        final String clsName=className != null ? className : element.getLabel();
        if (clsName != null)         cls=getOrCreateClass(clsName,element.getBaseClassName());
 else         throw new IllegalArgumentException("String_Node_Str" + input);
        for (        String f : element.getPropertyKeys()) {
          final String newName=transformFieldName(f);
          final String fName=newName != null ? newName : f;
          OProperty p=cls.getProperty(fName);
          if (p == null) {
            final Object fValue=element.getProperty(f);
            createProperty(cls,fName,fValue);
            if (newName != null) {
              element.removeProperty(f);
              element.setProperty(newName,fValue);
            }
          }
        }
      }
    }
  }
  if (tx && dbType == DB_TYPE.DOCUMENT) {
    final ODatabaseDocumentTx documentDatabase=pipeline.getDocumentDatabase();
    if (!documentDatabase.getTransaction().isActive())     documentDatabase.begin();
  }
  if (input instanceof OrientVertex) {
    final OrientVertex v=(OrientVertex)input;
    if (clusterName != null)     v.save(clusterName);
 else     v.save();
  }
 else   if (input instanceof ODocument) {
    final ODocument doc=(ODocument)input;
    if (className != null)     doc.setClassName(className);
    if (clusterName != null)     doc.save(clusterName);
 else     doc.save();
  }
  progress.incrementAndGet();
  if (batchCommit > 0) {
    if (batchCounter > batchCommit) {
      if (dbType == DB_TYPE.DOCUMENT) {
        final ODatabaseDocumentTx documentDatabase=pipeline.getDocumentDatabase();
        documentDatabase.commit();
        documentDatabase.begin();
      }
 else {
        pipeline.getGraphDatabase().commit();
      }
      batchCounter=0;
    }
 else     batchCounter++;
  }
}

Fixed version (ground truth):
public void load(final Object input,OCommandContext context){
  if (input == null)   return;
  if (dbAutoCreateProperties) {
    if (dbType == DB_TYPE.DOCUMENT) {
      if (input instanceof ODocument) {
        final ODocument doc=(ODocument)input;
        final ODatabaseDocumentTx documentDatabase=pipeline.getDocumentDatabase();
        final OClass cls;
        if (className != null)         cls=getOrCreateClass(className,null);
 else         cls=doc.getSchemaClass();
        for (        String f : doc.fieldNames()) {
          final String newName=transformFieldName(f);
          final String fName=newName != null ? newName : f;
          OProperty p=cls.getProperty(fName);
          if (p == null) {
            final Object fValue=doc.field(f);
            createProperty(cls,fName,fValue);
            if (newName != null) {
              doc.removeField(f);
              doc.field(newName,fValue);
            }
          }
        }
      }
    }
 else     if (dbType == DB_TYPE.GRAPH) {
      if (input instanceof OrientElement) {
        final OrientElement element=(OrientElement)input;
        final OClass cls;
        final String clsName=className != null ? className : (element instanceof OrientVertex ? ((OrientVertex)element).getLabel() : ((OrientEdge)element).getLabel());
        if (clsName != null)         cls=getOrCreateClass(clsName,element.getBaseClassName());
 else         throw new IllegalArgumentException("String_Node_Str" + input);
        for (        String f : element.getPropertyKeys()) {
          final String newName=transformFieldName(f);
          final String fName=newName != null ? newName : f;
          OProperty p=cls.getProperty(fName);
          if (p == null) {
            final Object fValue=element.getProperty(f);
            createProperty(cls,fName,fValue);
            if (newName != null) {
              element.removeProperty(f);
              element.setProperty(newName,fValue);
            }
          }
        }
      }
    }
  }
  if (tx && dbType == DB_TYPE.DOCUMENT) {
    final ODatabaseDocumentTx documentDatabase=pipeline.getDocumentDatabase();
    if (!documentDatabase.getTransaction().isActive())     documentDatabase.begin();
  }
  if (input instanceof OrientVertex) {
    final OrientVertex v=(OrientVertex)input;
    if (clusterName != null)     v.save(clusterName);
 else     v.save();
  }
 else   if (input instanceof ODocument) {
    final ODocument doc=(ODocument)input;
    if (className != null)     doc.setClassName(className);
    if (clusterName != null)     doc.save(clusterName);
 else     doc.save();
  }
  progress.incrementAndGet();
  if (batchCommit > 0) {
    if (batchCounter > batchCommit) {
      if (dbType == DB_TYPE.DOCUMENT) {
        final ODatabaseDocumentTx documentDatabase=pipeline.getDocumentDatabase();
        documentDatabase.commit();
        documentDatabase.begin();
      }
 else {
        pipeline.getGraphDatabase().commit();
      }
      batchCounter=0;
    }
 else     batchCounter++;
  }
}