Buggy code:
public class Document extends VEXDocumentImpl implements VEXDocument { private ListenerList listeners = new ListenerList ( DocumentListener . class , DocumentEvent . class ) ; private boolean undoEnabled = true ; protected String systemID ; protected org . w3c . dom . Document domDocument ; public Document ( VEXElement rootElement ) { } public Document ( org . w3c . dom . Document domDocument ) { } public Document ( Content content , VEXElement rootElement ) { } public void addDocumentListener ( DocumentListener listener ) { } public boolean canInsertFragment ( int offset , VEXDocumentFragment fragment ) { } public boolean canInsertText ( int offset ) { } public Position createPosition ( int offset ) { } public void delete ( int startOffset , int endOffset ) throws DocumentValidationException { } public VEXElement findCommonElement ( int offset1 , int offset2 ) { } public char getCharacterAt ( int offset ) { } public VEXElement getElementAt ( int offset ) { } public String getEncoding ( ) { } public VEXDocumentFragment getFragment ( int startOffset , int endOffset ) { } public int getLength ( ) { } public EList < String > getNodeNames ( int startOffset , int endOffset ) { } public EList < VEXNode > getNodes ( int startOffset , int endOffset ) { } static EList < VEXNode > createNodeList ( Content content , int startOffset , int endOffset , EList < VEXNode > elements ) { } public String getPublicID ( ) { } public String getRawText ( int startOffset , int endOffset ) { } public VEXElement getRootElement ( ) { } public String getSystemID ( ) { } public String getText ( int startOffset , int endOffset ) { } public Validator getValidator ( ) { } public void insertElement ( int offset , VEXElement element ) throws DocumentValidationException { } public void insertFragment ( int offset , VEXDocumentFragment fragment ) throws DocumentValidationException { } public void insertText ( int offset , String text ) throws DocumentValidationException { } public boolean isUndoEnabled ( ) { } public void removeDocumentListener ( DocumentListener listener ) { } public void setSystemID ( String systemID ) { } public void setUndoEnabled ( boolean undoEnabled ) { } public void setValidator ( Validator validator ) { } private class DeleteEdit implements IUndoableEdit { private int startOffset ; private int endOffset ; private VEXDocumentFragment frag ; public DeleteEdit ( int startOffset , int endOffset , VEXDocumentFragment frag ) { } public boolean combine ( IUndoableEdit edit ) { } public void undo ( ) throws CannotUndoException { } public void redo ( ) throws CannotRedoException { } } private class InsertElementEdit implements IUndoableEdit { private int offset ; private VEXElement element ; public InsertElementEdit ( int offset , VEXElement element2 ) { } public boolean combine ( IUndoableEdit edit ) { } public void undo ( ) throws CannotUndoException { } public void redo ( ) throws CannotRedoException { } } private class InsertFragmentEdit implements IUndoableEdit { private int offset ; private VEXDocumentFragment frag ; public InsertFragmentEdit ( int offset , VEXDocumentFragment frag ) { } public boolean combine ( IUndoableEdit edit ) { } public void undo ( ) throws CannotUndoException { } public void redo ( ) throws CannotRedoException { } } private class InsertTextEdit implements IUndoableEdit { private int offset ; private String text ; public InsertTextEdit ( int offset , String text ) { } public boolean combine ( IUndoableEdit edit ) { } public void undo ( ) throws CannotUndoException { } public void redo ( ) throws CannotRedoException { } } private static void assertOffset ( int offset , int min , int max ) { } private VEXElement cloneElement ( VEXElement original , Content content , int shift , VEXElement parent ) { } public void fireAttributeChanged ( DocumentEvent e ) { } private void fireBeforeContentDeleted ( DocumentEvent e ) { } private void fireBeforeContentInserted ( DocumentEvent e ) { } private void fireContentDeleted ( DocumentEvent e ) { } private void fireContentInserted ( DocumentEvent e ) { } @ Override public void setDOMDocument ( org . w3c . dom . Document domDocument ) { } @ Override public org . w3c . dom . Document getDOMDocument ( ) { } private void synchronizeDocuments ( ) { } private void synchronizeRootElement ( ) { } private void synchronizeAttributeNodes ( VEXElement vexElement , Element domElement ) { } private void synchronizeChildNodes ( VEXElement vexElement , Element domElement ) { NodeList domNodes = domElement . getChildNodes ( ) ; if ( ( domNodes . getLength ( ) ) > 0 ) { for ( int nodeCount = 0 ; nodeCount < ( domNodes . getLength ( ) ) ; nodeCount ++ ) { Node domNode = domNodes . item ( nodeCount ) ; if ( ( domNode . getNodeType ( ) ) == ( Node . ELEMENT_NODE ) ) { VEXElement element = new Element ( domNode . getNodeName ( ) ) ; synchronizeChildNodes ( element , ( ( Element ) ( domNode ) ) ) ; synchronizeAttributeNodes ( element , ( ( Element ) ( domNode ) ) ) ; element . setElement ( ( ( Element ) ( domNode ) ) ) ; vexElement . addChild ( element ) ; } if ( ( domNode . getNodeType ( ) ) == ( Node . TEXT_NODE ) ) { int offset = content . getLength ( ) ; String text = domNode . getNodeValue ( ) ; <START_BUG> content . insertString ( this . content . getLength ( ) , domNode . getNodeValue ( ) ) ; <END_BUG> content . insertString ( content . getLength ( ) , "" ) ; vexElement . setContent ( content , offset , ( ( content . getLength ( ) ) - 1 ) ) ; } } } } }

Fix:
content . insertString ( this . content . getLength ( ) , text ) ;