Buggy code:
public class IteratorView extends JFrame implements ActionListener { private static final long serialVersionUID = 3256726186452662580L ; Document document ; TreeNode lastSelected ; DOMParser parser ; JTextArea messageText ; JScrollPane messageScroll ; DOMTreeFull jtree ; NodeIterator iterator ; NameNodeFilter nameNodeFilter ; JButton nextButton ; JButton prevButton ; JButton removeButton ; JButton addButton ; JTextField addText ; JButton newIterator ; JList whatToShow ; JCheckBox match ; JTextField nameFilter ; String [ ] whatArray = new String [ ] { "ALL" , "ELEMENT" , "ATTRIBUTE" , "TEXT" , "CDATA_SECTION" , "ENTITY_REFERENCE" , "ENTITY" , "PROCESSING_INSTRUCTION" , "COMMENT" , "DOCUMENT" , "DOCUMENT_TYPE" , "DOCUMENT_FRAGMENT" , "NOTATION" } ; JCheckBox expandERs ; Hashtable treeNodeMap = new Hashtable ( ) ; public static void main ( String [ ] args ) { } public IteratorView ( String filename ) { } public void actionPerformed ( ActionEvent e ) { if ( ( e . getSource ( ) ) == ( newIterator ) ) { Node node = document ; int [ ] indices = whatToShow . getSelectedIndices ( ) ; int mask = 0 ; for ( int i = 0 ; i < ( indices . length ) ; i ++ ) { if ( ( indices [ i ] ) == 0 ) { mask = 65535 ; break ; } else { mask = mask | ( 1 << ( ( indices [ i ] ) - 1 ) ) ; } } String nameText = nameFilter . getText ( ) ; boolean matched = match . isSelected ( ) ; if ( ( nameNodeFilter ) == null ) { nameNodeFilter = new NameNodeFilter ( ) ; } <START_BUG> if ( nameText . equals ( "" ) ) { <END_BUG> setMessage ( "NodeNameFilter<seq2seq4repair_space>name<seq2seq4repair_space>is<seq2seq4repair_space>\"\".<seq2seq4repair_space>Assuming<seq2seq4repair_space>null." ) ; nameText = null ; } nameNodeFilter . setName ( nameText ) ; nameNodeFilter . setMatch ( matched ) ; if ( ( iterator ) != null ) iterator . detach ( ) ; boolean expand = expandERs . isSelected ( ) ; iterator = ( ( DocumentTraversal ) ( document ) ) . createNodeIterator ( node , ( ( short ) ( mask ) ) , nameNodeFilter , expand ) ; setMessage ( ( ( ( ( ( ( ( ( ( "doc.createNodeIterator(" + "<seq2seq4repair_space>root=" ) + node ) + ",<seq2seq4repair_space>whatToShow=" ) + mask ) + ",<seq2seq4repair_space>match=" ) + matched ) + ",<seq2seq4repair_space>name=" ) + nameText ) + ")" ) ) ; return ; } if ( ( e . getSource ( ) ) == ( addButton ) ) { String text = addText . getText ( ) ; if ( text == null ) return ; TreeNode treeNode = ( ( TreeNode ) ( jtree . getLastSelectedPathComponent ( ) ) ) ; if ( treeNode == null ) { messageText . append ( "Must<seq2seq4repair_space>select<seq2seq4repair_space>a<seq2seq4repair_space>tree<seq2seq4repair_space>component<seq2seq4repair_space>to<seq2seq4repair_space>add<seq2seq4repair_space>a<seq2seq4repair_space>child<seq2seq4repair_space>to<seq2seq4repair_space>it." ) ; return ; } TreePath path = new TreePath ( ( ( DefaultTreeModel ) ( jtree . getModel ( ) ) ) . getPathToRoot ( treeNode ) ) ; if ( path == null ) { setMessage ( "Could<seq2seq4repair_space>not<seq2seq4repair_space>create<seq2seq4repair_space>a<seq2seq4repair_space>path." ) ; return ; } if ( ! ( jtree . getSelectionModel ( ) . isPathSelected ( path ) ) ) return ; Node node = jtree . getNode ( treeNode ) ; Node textNode = document . createTextNode ( text ) ; try { node . appendChild ( textNode ) ; } catch ( DOMException dome ) { setMessage ( ( ( ( "DOMException:" + ( dome . code ) ) + ",<seq2seq4repair_space>" ) + dome ) ) ; return ; } ( ( DOMTreeFull . Model ) ( jtree . getModel ( ) ) ) . insertNode ( textNode , ( ( MutableTreeNode ) ( treeNode ) ) ) ; return ; } if ( ( e . getSource ( ) ) == ( nextButton ) ) { Node node = iterator . nextNode ( ) ; if ( node == null ) { setMessage ( "iterator.nextNode()<seq2seq4repair_space>==<seq2seq4repair_space>null" ) ; return ; } setMessage ( ( "iterator.nextNode()<seq2seq4repair_space>==<seq2seq4repair_space>" + node ) ) ; TreeNode treeNode = jtree . getTreeNode ( node ) ; if ( treeNode == null ) { setMessage ( ( "No<seq2seq4repair_space>JTree<seq2seq4repair_space>TreeNode<seq2seq4repair_space>for<seq2seq4repair_space>Node<seq2seq4repair_space>name:" + ( node . getNodeName ( ) ) ) ) ; return ; } TreePath path = new TreePath ( ( ( DefaultTreeModel ) ( jtree . getModel ( ) ) ) . getPathToRoot ( treeNode ) ) ; jtree . requestFocus ( ) ; jtree . setSelectionPath ( path ) ; jtree . scrollPathToVisible ( path ) ; return ; } if ( ( e . getSource ( ) ) == ( prevButton ) ) { Node node = iterator . previousNode ( ) ; if ( node == null ) { setMessage ( "iterator.previousNode()<seq2seq4repair_space>==<seq2seq4repair_space>null" ) ; return ; } setMessage ( ( "iterator.previousNode()<seq2seq4repair_space>==<seq2seq4repair_space>" + node ) ) ; TreeNode treeNode = jtree . getTreeNode ( node ) ; if ( treeNode == null ) { setMessage ( ( "No<seq2seq4repair_space>JTree<seq2seq4repair_space>TreeNode<seq2seq4repair_space>for<seq2seq4repair_space>Node<seq2seq4repair_space>name:" + ( node . getNodeName ( ) ) ) ) ; return ; } TreePath path = new TreePath ( ( ( DefaultTreeModel ) ( jtree . getModel ( ) ) ) . getPathToRoot ( treeNode ) ) ; jtree . requestFocus ( ) ; jtree . setSelectionPath ( path ) ; jtree . scrollPathToVisible ( path ) ; return ; } if ( ( e . getSource ( ) ) == ( removeButton ) ) { TreeNode treeNode = ( ( TreeNode ) ( jtree . getLastSelectedPathComponent ( ) ) ) ; if ( treeNode == null ) { messageText . append ( "Must<seq2seq4repair_space>select<seq2seq4repair_space>a<seq2seq4repair_space>tree<seq2seq4repair_space>component<seq2seq4repair_space>to<seq2seq4repair_space>remove<seq2seq4repair_space>it." ) ; return ; } TreePath path = new TreePath ( ( ( DefaultTreeModel ) ( jtree . getModel ( ) ) ) . getPathToRoot ( treeNode ) ) ; if ( path == null ) { setMessage ( "Could<seq2seq4repair_space>not<seq2seq4repair_space>create<seq2seq4repair_space>a<seq2seq4repair_space>path." ) ; return ; } if ( ! ( jtree . getSelectionModel ( ) . isPathSelected ( path ) ) ) return ; Node node = jtree . getNode ( treeNode ) ;

Fix:
if ( ( nameText . length ( ) ) == 0 ) {