Buggy code:
public class TreeWalkerView extends JFrame implements ActionListener { private static final long serialVersionUID = 3257566187583189559L ; Document document ; TreeNode lastSelected ; DOMParser parser ; JTextArea messageText ; JScrollPane messageScroll ; DOMTreeFull jtree ; TreeWalker treeWalker ; NameNodeFilter nameNodeFilter ; JButton nextButton ; JButton prevButton ; JButton removeButton ; JButton addButton ; JTextField addText ; JButton newIterator ; JList whatToShow ; JCheckBox match ; JTextField nameFilter ; JButton parentButton ; JButton nextSiblingButton ; JButton previousSiblingButton ; JButton firstChildButton ; JButton lastChildButton ; JButton currentButton ; String [ ] whatArray = new String [ ] { "ALL" , "ELEMENT" , "ATTRIBUTE" , "TEXT" , "CDATA_SECTION" , "ENTITY_REFERENCE" , "ENTITY" , "PROCESSING_INSTRUCTION" , "COMMENT" , "DOCUMENT" , "DOCUMENT_TYPE" , "DOCUMENT_FRAGMENT" , "NOTATION" } ; JCheckBox expandERs ; public static void main ( String [ ] args ) { } Hashtable treeNodeMap = new Hashtable ( ) ; public TreeWalkerView ( String filename ) { } public void actionPerformed ( ActionEvent e ) { if ( ( e . getSource ( ) ) == ( newIterator ) ) { TreeNode treeNode = ( ( TreeNode ) ( jtree . getLastSelectedPathComponent ( ) ) ) ; if ( treeNode == null ) { messageText . append ( "Must<seq2seq4repair_space>select<seq2seq4repair_space>a<seq2seq4repair_space>tree<seq2seq4repair_space>component." ) ; return ; } Node node = jtree . getNode ( treeNode ) ; if ( node == null ) { setMessage ( ( "No<seq2seq4repair_space>current<seq2seq4repair_space>Node<seq2seq4repair_space>in<seq2seq4repair_space>TreeNode:<seq2seq4repair_space>" + node ) ) ; } 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 ) ; boolean expand = expandERs . isSelected ( ) ; treeWalker = ( ( DocumentTraversal ) ( document ) ) . createTreeWalker ( node , mask , nameNodeFilter , expand ) ; setMessage ( ( ( ( ( ( ( ( ( "createTreeWalker:" + "<seq2seq4repair_space>root=" ) + node ) + ",<seq2seq4repair_space>whatToShow=" ) + mask ) + ",<seq2seq4repair_space>match=" ) + matched ) + ",<seq2seq4repair_space>name=" ) + nameText ) ) ; return ; } if ( ( e . getSource ( ) ) == ( currentButton ) ) { TreeNode treeNode = ( ( TreeNode ) ( jtree . getLastSelectedPathComponent ( ) ) ) ; if ( treeNode == null ) { messageText . append ( "Must<seq2seq4repair_space>select<seq2seq4repair_space>a<seq2seq4repair_space>tree<seq2seq4repair_space>component." ) ; return ; } Node node = jtree . getNode ( treeNode ) ; if ( node == null ) { setMessage ( ( "No<seq2seq4repair_space>current<seq2seq4repair_space>Node<seq2seq4repair_space>in<seq2seq4repair_space>TreeNode:<seq2seq4repair_space>" + node ) ) ; } treeWalker . setCurrentNode ( node ) ; 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 ( ) ) == ( 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 ) ; if ( node == null ) return ; Node parent = node . getParentNode ( ) ; if ( parent == null ) return ; parent . removeChild ( node ) ; ( ( DefaultTreeModel ) ( jtree . getModel ( ) ) ) . removeNodeFromParent ( ( ( MutableTreeNode ) ( treeNode ) ) ) ; return ; } if ( ( e . getSource ( ) ) == ( previousSiblingButton ) ) { Node node = treeWalker . previousSibling ( ) ; handleButton ( node , "previousSibling()" ) ; return ; } if ( ( e . getSource ( ) ) == ( firstChildButton ) ) { Node node = treeWalker . firstChild ( ) ; handleButton ( node , "firstChild()" ) ; return ; }

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