Buggy code:
public class TableController implements TreeSelectionListener { private HeaderTableMenu menu ; private TableView headerTable ; private HeaderTableModel headerTableModel ; public CScrollPane scrollPane ; private SwingWorker worker ; private Folder folder ; private HeaderList headerList ; private FilterToolbar filterToolbar ; private HeaderTableActionListener headerTableActionListener ; private MessageNode [ ] messageNodes ; private MessageNode node ; private MessageNode oldNode ; private Object [ ] selection ; private HeaderTableMouseListener headerTableMouseListener ; private HeaderTableDnd headerTableDnd ; private HeaderTableFocusListener headerTableFocusListener ; private HeaderItemActionListener headerItemActionListener ; private FilterActionListener filterActionListener ; private TableItem headerTableItem ; private boolean folderChanged = false ; private int counter = 1 ; protected TableView view ; protected HeaderTableActionListener actionListener ; protected TableSelectionManager tableSelectionManager ; protected MailFrameController mailFrameController ; protected Object [ ] newUidList ; protected MarkAsReadTimer markAsReadTimer ; protected Vector tableChangedListenerList ; public TableController ( MailFrameController mailFrameController ) { } public void addTableChangedListener ( TableChangeListener l ) { } public void fireTableChangedEvent ( TableChangedEvent e ) { } public TableView getView ( ) { } public HeaderTableMouseListener getHeaderTableMouseListener ( ) { } public boolean hasFocus ( ) { } public FilterToolbar getFilterToolbar ( ) { } public TableItem getHeaderTableItem ( ) { } public HeaderTableActionListener getActionListener ( ) { } public void saveColumnConfig ( ) { } public void setFolder ( Folder f ) { } public Folder getFolder ( ) { } public TableView getHeaderTable ( ) { } public HeaderTableModel getHeaderTableModel ( ) { } public void clearMessageNodeList ( ) { } public HeaderItemActionListener getHeaderItemActionListener ( ) { } public FilterActionListener getFilterActionListener ( ) { } public void valueChanged ( TreeSelectionEvent e ) { } public void showMessage ( ) { } public JPopupMenu getPopupMenu ( ) { } public void tableChanged ( TableChangedEvent event ) throws Exception { log . info ( ( "event=" + event ) ) ; FolderTreeNode folder = event . getSrcFolder ( ) ; if ( folder == null ) { if ( ( event . getEventType ( ) ) == ( TableChangedEvent . UPDATE ) ) getHeaderTableModel ( ) . update ( ) ; fireTableChangedEvent ( event ) ; return ; } <START_BUG> FolderCommandReference [ ] r = ( ( FolderCommandReference [ ] ) ( mailFrameController . getSelectionManager ( ) . getSelection ( "mail.headertable" ) ) ) ; <END_BUG> Folder srcFolder = ( ( Folder ) ( r [ 0 ] . getFolder ( ) ) ) ; if ( ! ( folder . equals ( srcFolder ) ) ) return ; switch ( event . getEventType ( ) ) { case TableChangedEvent . UPDATE : { getHeaderTableModel ( ) . update ( ) ; break ; } case TableChangedEvent . ADD : { getHeaderTableModel ( ) . addHeaderList ( event . getHeaderList ( ) ) ; break ; } case TableChangedEvent . REMOVE : { getHeaderTableModel ( ) . removeHeaderList ( event . getUids ( ) ) ; break ; } case TableChangedEvent . MARK : { getHeaderTableModel ( ) . markHeader ( event . getUids ( ) , event . getMarkVariant ( ) ) ; break ; } } fireTableChangedEvent ( event ) ; } public TableSelectionManager getTableSelectionManager ( ) { } public MailFrameController getMailFrameController ( ) { } public MarkAsReadTimer getMarkAsReadTimer ( ) { } }

Fix:
FolderCommandReference [ ] r = ( ( FolderCommandReference [ ] ) ( mailFrameController . getSelectionManager ( ) . getSelection ( "mail.table" ) ) ) ;