Buggy code:
public class FolderTreeActionListener implements ActionListener { public BasicAction addAction ; public BasicAction addVirtualAction ; public BasicAction removeAction ; public BasicAction renameAction ; public BasicAction expungeAction ; public BasicAction emptyAction ; public BasicAction compactAction ; public BasicAction applyFilterAction ; public BasicAction filterPreferencesAction ; public BasicAction moveupAction ; public BasicAction movedownAction ; public BasicAction subscribeAction ; public BasicAction unsubscribeAction ; private TreeController treeController ; public FolderTreeActionListener ( TreeController treeController ) { } public void initActions ( ) { } public void actionPerformed ( ActionEvent e ) { String command = e . getActionCommand ( ) ; if ( command . equals ( "CREATE_SUBFOLDER" ) ) { EditFolderDialog dialog = new EditFolderDialog ( "New<seq2seq4repair_space>Folder" ) ; dialog . showDialog ( ) ; String name ; if ( ( dialog . success ( ) ) == true ) { name = dialog . getName ( ) ; } else { return ; } FolderCommandReference [ ] r = ( ( FolderCommandReference [ ] ) ( treeController . getTreeSelectionManager ( ) . getSelection ( ) ) ) ; r [ 0 ] . setFolderName ( name ) ; processor . addOp ( new org . columba . mail . gui . tree . command . CreateSubFolderCommand ( r ) ) ; } else if ( command . equals ( "CREATE_VIRTUAL_SUBFOLDER" ) ) { EditFolderDialog dialog = new EditFolderDialog ( "New<seq2seq4repair_space>Folder" ) ; dialog . showDialog ( ) ; String name ; if ( ( dialog . success ( ) ) == true ) { name = dialog . getName ( ) ; try { <START_BUG> treeController . getTreeSelectionManager ( ) . getFolder ( ) . addFolder ( name , VirtualFolder . class ) ; <END_BUG> treeModel . nodeStructureChanged ( treeController . getTreeSelectionManager ( ) . getFolder ( ) ) ; } catch ( Exception ex ) { ex . printStackTrace ( ) ; } } else { return ; } } else if ( command . equals ( "RENAME_FOLDER" ) ) { EditFolderDialog dialog = new EditFolderDialog ( "New<seq2seq4repair_space>Folder" ) ; dialog . showDialog ( ) ; String name ; if ( ( dialog . success ( ) ) == true ) { name = dialog . getName ( ) ; } else { return ; } FolderCommandReference [ ] r = ( ( FolderCommandReference [ ] ) ( treeController . getTreeSelectionManager ( ) . getSelection ( ) ) ) ; r [ 0 ] . setFolderName ( name ) ; processor . addOp ( new org . columba . mail . folder . command . RenameFolderCommand ( r ) ) ; } else if ( command . equals ( "APPLYFILTER" ) ) { FolderCommandReference [ ] r = ( ( FolderCommandReference [ ] ) ( treeController . getTreeSelectionManager ( ) . getSelection ( ) ) ) ; processor . addOp ( new org . columba . mail . folder . command . ApplyFilterCommand ( r ) ) ; } else if ( command . equals ( "REMOVE_FOLDER" ) ) { FolderCommandReference [ ] r = ( ( FolderCommandReference [ ] ) ( treeController . getTreeSelectionManager ( ) . getSelection ( ) ) ) ; Folder folder = ( ( Folder ) ( r [ 0 ] . getFolder ( ) ) ) ; if ( ! ( folder . isLeaf ( ) ) ) { JOptionPane . showMessageDialog ( null , "Your<seq2seq4repair_space>can<seq2seq4repair_space>only<seq2seq4repair_space>remove<seq2seq4repair_space>leaf<seq2seq4repair_space>folders!" ) ; return ; } processor . addOp ( new org . columba . mail . folder . command . RemoveFolderCommand ( r ) ) ; } else if ( command . equals ( "FILTER_PREFERENCES" ) ) { FolderCommandReference [ ] r = ( ( FolderCommandReference [ ] ) ( treeController . getTreeSelectionManager ( ) . getSelection ( ) ) ) ; Folder folder = ( ( Folder ) ( r [ 0 ] . getFolder ( ) ) ) ; if ( folder == null ) return ; FolderItem item = folder . getFolderItem ( ) ; if ( item == null ) return ; folder . showFilterDialog ( treeController . getMailFrameController ( ) ) ; } else if ( command . equals ( "EXPUNGE_FOLDER" ) ) { log . info ( ( "treeController=" + ( treeController ) ) ) ; log . info ( ( "selectionmanager=" + ( treeController . getTreeSelectionManager ( ) ) ) ) ; FolderCommandReference [ ] r = ( ( FolderCommandReference [ ] ) ( treeController . getTreeSelectionManager ( ) . getSelection ( ) ) ) ; ExpungeFolderCommand c = new ExpungeFolderCommand ( r ) ; processor . addOp ( c ) ; } else if ( command . equals ( "EMPTY_FOLDER" ) ) { Folder folder = treeController . getView ( ) . getSelected ( ) ; } else if ( command . equals ( "SUBSCRIBE" ) ) { System . out . println ( "subscsribe" ) ; } } public void changeActions ( ) { } }

Fix:
treeController . getTreeSelectionManager ( ) . getFolder ( ) . addFolder ( name , "VirtualFolder" ) ;