Buggy code:
protected transient int fNodeCount = 0 ; protected transient int [ ] [ ] fNodeType ; protected transient int [ ] [ ] fNodeName ; protected transient int [ ] [ ] fNodeValue ; protected transient int [ ] [ ] fNodeParent ; protected transient int [ ] [ ] fNodeFirstChild ; protected transient int [ ] [ ] fNodeNextSib ; protected transient int fIdCount ; protected transient int [ ] fIdName ; protected transient int [ ] fIdElement ; protected transient StringPool fStringPool ; protected boolean fNamespacesEnabled = false ; public DeferredDocumentImpl ( StringPool stringPool ) { } public DeferredDocumentImpl ( StringPool stringPool , boolean namespacesEnabled ) { } public DeferredDocumentImpl ( StringPool stringPool , boolean namespaces , boolean grammarAccess ) { } boolean getNamespacesEnabled ( ) { } public int createDocument ( ) { } public int createDocumentType ( int rootElementNameIndex , int publicId , int systemId ) { } public void setInternalSubset ( int doctypeIndex , int subsetIndex ) { } public int createNotation ( int notationName , int publicId , int systemId ) throws Exception { } public int createEntity ( int entityName , int publicId , int systemId , int notationName ) throws Exception { } public int createEntityReference ( int nameIndex ) throws Exception { } public int createElement ( int elementNameIndex , XMLAttrList attrList , int attrListIndex ) { } public int createAttribute ( int attrNameIndex , int attrValueIndex , boolean specified ) { } public int createElementDefinition ( int elementNameIndex ) { } public int createTextNode ( int dataIndex , boolean ignorableWhitespace ) { } public int createCDATASection ( int dataIndex , boolean ignorableWhitespace ) { } public int createProcessingInstruction ( int targetIndex , int dataIndex ) { } public int createComment ( int dataIndex ) { } public void appendChild ( int parentIndex , int childIndex ) { } public int setAttributeNode ( int elemIndex , int attrIndex ) { } public int insertBefore ( int parentIndex , int newChildIndex , int refChildIndex ) { } public void setAsFirstChild ( int parentIndex , int childIndex ) { } public int getParentNode ( int nodeIndex ) { } public int getFirstChild ( int nodeIndex ) { } public int getNextSibling ( int nodeIndex ) { } public int getRealNextSibling ( int nodeIndex ) { } public int lookupElementDefinition ( int elementNameIndex ) { } public DeferredNode getNodeObject ( int nodeIndex ) { if ( nodeIndex == ( - 1 ) ) { return null ; } int chunk = nodeIndex > > ( DeferredDocumentImpl . CHUNK_SHIFT ) ; int index = nodeIndex & ( DeferredDocumentImpl . CHUNK_MASK ) ; int type = clearChunkIndex ( fNodeType , chunk , index ) ; clearChunkIndex ( fNodeParent , chunk , index ) ; DeferredNode node = null ; switch ( type ) { case Node . ATTRIBUTE_NODE : { if ( fNamespacesEnabled ) { node = new DeferredAttrNSImpl ( this , nodeIndex ) ; } else { node = new DeferredAttrImpl ( this , nodeIndex ) ; } break ; } case Node . CDATA_SECTION_NODE : { node = new DeferredCDATASectionImpl ( this , nodeIndex ) ; break ; } case Node . COMMENT_NODE : { node = new DeferredCommentImpl ( this , nodeIndex ) ; break ; } case Node . DOCUMENT_NODE : { node = this ; break ; } case Node . DOCUMENT_TYPE_NODE : { node = new DeferredDocumentTypeImpl ( this , nodeIndex ) ; docType = ( ( DocumentTypeImpl ) ( node ) ) ; break ; } case Node . ELEMENT_NODE : { if ( DeferredDocumentImpl . DEBUG_IDS ) { System . out . println ( ( "getNodeObject(ELEMENT_NODE):<seq2seq4repair_space>" + nodeIndex ) ) ; } if ( fNamespacesEnabled ) { node = new DeferredElementNSImpl ( this , nodeIndex ) ; } else { node = new DeferredElementImpl ( this , nodeIndex ) ; } if ( ( docElement ) == null ) { docElement = ( ( ElementImpl ) ( node ) ) ; } if ( ( fIdElement ) != null ) { <START_BUG> int idIndex = DeferredDocumentImpl . binarySearch ( fIdElement , 0 , fIdCount , nodeIndex ) ; <END_BUG> while ( idIndex != ( - 1 ) ) { if ( DeferredDocumentImpl . DEBUG_IDS ) { System . out . println ( ( "<seq2seq4repair_space>id<seq2seq4repair_space>index:<seq2seq4repair_space>" + idIndex ) ) ; System . out . println ( ( ( ( "<seq2seq4repair_space>fIdName[" + idIndex ) + "]:<seq2seq4repair_space>" ) + ( fIdName [ idIndex ] ) ) ) ; } int nameIndex = fIdName [ idIndex ] ; if ( nameIndex != ( - 1 ) ) { String name = fStringPool . toString ( nameIndex ) ; if ( DeferredDocumentImpl . DEBUG_IDS ) { System . out . println ( ( "<seq2seq4repair_space>name:<seq2seq4repair_space>" + name ) ) ; System . out . print ( "getNodeObject()#" ) ; } putIdentifier0 ( name , ( ( Element ) ( node ) ) ) ; fIdName [ idIndex ] = - 1 ; } if ( ( ( idIndex + 1 ) < ( fIdCount ) ) && ( ( fIdElement [ ( idIndex + 1 ) ] ) == nodeIndex ) ) { idIndex ++ ; } else { idIndex = - 1 ; } } } break ; } case Node . ENTITY_NODE : { node = new DeferredEntityImpl ( this , nodeIndex ) ; break ; } case Node . ENTITY_REFERENCE_NODE : { node = new DeferredEntityReferenceImpl ( this , nodeIndex ) ; break ; } case Node . NOTATION_NODE : { node = new DeferredNotationImpl ( this , nodeIndex ) ; break ; } case Node . PROCESSING_INSTRUCTION_NODE : { node = new DeferredProcessingInstructionImpl ( this , nodeIndex ) ; break ; } case Node . TEXT_NODE : { node = new DeferredTextImpl ( this , nodeIndex ) ; break ; } case NodeImpl . ELEMENT_DEFINITION_NODE : { node = new DeferredElementDefinitionImpl ( this , nodeIndex ) ; break ;

Fix:
int idIndex = DeferredDocumentImpl . binarySearch ( fIdElement , 0 , ( ( fIdCount ) - 1 ) , nodeIndex ) ;