Buggy code:
public class OrientEdgeIterator extends OLazyWrapperIterator < OrientEdge > { private final OrientVertex sourceVertex ; private final OrientVertex targetVertex ; private final OPair < Direction , String > connection ; private final String [ ] labels ; public OrientEdgeIterator ( final OrientVertex iSourceVertex , final OrientVertex iTargetVertex , final Iterator < ? > iterator , final OPair < Direction , String > connection , final String [ ] iLabels , final int iSize ) { } @ Override public OrientEdge createGraphElement ( final Object iObject ) { if ( iObject instanceof OrientEdge ) return ( ( OrientEdge ) ( iObject ) ) ; final OIdentifiable rec = ( ( OIdentifiable ) ( iObject ) ) ; final ORecord record = rec . getRecord ( ) ; if ( record == null ) { OLogManager . instance ( ) . warn ( this , "Record<seq2seq4repair_space>(%s)<seq2seq4repair_space>is<seq2seq4repair_space>null" , rec ) ; return null ; } if ( ! ( record instanceof ODocument ) ) { OLogManager . instance ( ) . warn ( this , "Found<seq2seq4repair_space>a<seq2seq4repair_space>record<seq2seq4repair_space>(%s)<seq2seq4repair_space>that<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>an<seq2seq4repair_space>edge.<seq2seq4repair_space>Source<seq2seq4repair_space>vertex<seq2seq4repair_space>:<seq2seq4repair_space>%s,<seq2seq4repair_space>Target<seq2seq4repair_space>vertex<seq2seq4repair_space>:<seq2seq4repair_space>%s,<seq2seq4repair_space>Database<seq2seq4repair_space>:<seq2seq4repair_space>%s<seq2seq4repair_space>." , rec , ( ( sourceVertex ) != null ? sourceVertex . getIdentity ( ) : null ) , ( ( targetVertex ) != null ? targetVertex . getIdentity ( ) : null ) , record . getDatabase ( ) . getURL ( ) ) ; return null ; } final ODocument value = rec . getRecord ( ) ; if ( value == null ) { return null ; } OClass immutableSchema = ODocumentInternal . getImmutableSchemaClass ( value ) ; if ( immutableSchema == null ) { ODatabaseDocument db = value . getDatabaseIfDefined ( ) ; if ( db == null ) { return null ; } db . getMetadata ( ) . reload ( ) ; immutableSchema = ODocumentInternal . getImmutableSchemaClass ( value ) ; if ( immutableSchema == null ) { return null ; } } final OrientEdge edge ; if ( immutableSchema . isSubClassOf ( CLASS_NAME ) ) { if ( ( connection . getKey ( ) ) == ( Direction . OUT ) ) edge = new OrientEdge ( this . sourceVertex . getGraph ( ) , this . sourceVertex . getIdentity ( ) , rec . getIdentity ( ) , connection . getValue ( ) ) ; else edge = new OrientEdge ( this . sourceVertex . getGraph ( ) , rec . getIdentity ( ) , this . sourceVertex . getIdentity ( ) , connection . getValue ( ) ) ; } else if ( ODocumentInternal . getImmutableSchemaClass ( value ) . isSubClassOf ( OrientEdgeType . CLASS_NAME ) ) { <START_BUG> edge = new OrientEdge ( this . sourceVertex . getGraph ( ) , rec . getIdentity ( ) ) ; <END_BUG> } else throw new IllegalStateException ( ( ( "Invalid<seq2seq4repair_space>content<seq2seq4repair_space>found<seq2seq4repair_space>while<seq2seq4repair_space>iterating<seq2seq4repair_space>edges,<seq2seq4repair_space>value<seq2seq4repair_space>'" + value ) + "'<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>an<seq2seq4repair_space>edge" ) ) ; if ( ( this . sourceVertex . settings . isUseVertexFieldsForEdgeLabels ( ) ) || ( edge . isLabeled ( labels ) ) ) return edge ; return null ; } public boolean filter ( final OrientEdge iObject ) { } }

Fix:
edge = new OrientEdge ( this . sourceVertex . getGraph ( ) , rec . getIdentity ( ) , connection . getValue ( ) ) ;