Buggy code:
public class FilterToolbar extends JPanel implements ActionListener { public JToggleButton newButton ; public JToggleButton oldButton ; private JToggleButton answeredButton ; private JToggleButton flaggedButton ; private JToggleButton expungedButton ; private JToggleButton draftButton ; private JToggleButton attachmentButton ; private JToggleButton secureButton ; public JButton clearButton ; public JButton advancedButton ; private JLabel label ; private JTextField textField ; private TableController tableController ; public FilterToolbar ( TableController headerTableViewer ) { } public void initComponents ( ) { } public void layoutComponents ( ) { } public void update ( ) throws Exception { } public void actionPerformed ( ActionEvent e ) { String action = e . getActionCommand ( ) ; try { TableModelFilter model = tableController . getTableModelFilteredView ( ) ; if ( action . equals ( "ADVANCED" ) ) { MessageFolder searchFolder = ( ( MessageFolder ) ( treeModel . getFolder ( 106 ) ) ) ; <START_BUG> MessageFolder folder = ( ( MessageFolder ) ( ( ( org . columba . mail . gui . frame . MailFrameMediator ) ( tableController . getFrameController ( ) ) ) . getTableSelection ( ) [ 0 ] . getFolder ( ) ) ) ; <END_BUG> if ( folder == null ) { return ; } SearchFrame frame = new SearchFrame ( tableController . getFrameController ( ) , searchFolder , folder ) ; } else if ( action . equals ( "NEW" ) ) { model . setNewFlag ( ( ! ( model . getNewFlag ( ) ) ) ) ; update ( ) ; } else if ( action . equals ( "ANSWERED" ) ) { model . setAnsweredFlag ( ( ! ( model . getAnsweredFlag ( ) ) ) ) ; update ( ) ; } else if ( action . equals ( "FLAGGED" ) ) { model . setFlaggedFlag ( ( ! ( model . getFlaggedFlag ( ) ) ) ) ; update ( ) ; } else if ( action . equals ( "EXPUNGED" ) ) { model . setExpungedFlag ( ( ! ( model . getExpungedFlag ( ) ) ) ) ; update ( ) ; } else if ( action . equals ( "ATTACHMENT" ) ) { model . setAttachmentFlag ( ( ! ( model . getAttachmentFlag ( ) ) ) ) ; update ( ) ; } else if ( action . equals ( "TEXTFIELD" ) ) { model . setPatternString ( textField . getText ( ) ) ; update ( ) ; } else if ( action . equals ( "CLEAR" ) ) { if ( model == null ) { return ; } model . setNewFlag ( false ) ; model . setAnsweredFlag ( false ) ; model . setFlaggedFlag ( false ) ; model . setExpungedFlag ( false ) ; model . setAttachmentFlag ( false ) ; model . setPatternString ( "" ) ; textField . setText ( "" ) ; newButton . setSelected ( false ) ; answeredButton . setSelected ( false ) ; flaggedButton . setSelected ( false ) ; expungedButton . setSelected ( false ) ; attachmentButton . setSelected ( false ) ; tableController . getTableModelFilteredView ( ) . setDataFiltering ( true ) ; update ( ) ; } } catch ( Exception ex ) { ex . printStackTrace ( ) ; } } public void enableNew ( boolean b ) { } public void enableAnswered ( boolean b ) { } public void enableFlagged ( boolean b ) { } public void enableAttachment ( boolean b ) { } public void enableExpunged ( boolean b ) { } public void setPattern ( String pattern ) { } }

Fix:
MessageFolder folder = ( ( MessageFolder ) ( ( ( org . columba . mail . gui . frame . MailFrameMediator ) ( tableController . getFrameController ( ) ) ) . getTableSelection ( ) . getFolder ( ) ) ) ;