Buggy code:
public class VirtualFolder extends AbstractMessageFolder implements FolderListener { private static final Logger LOG = Logger . getLogger ( "org.columba.mail.folder.virtual" ) ; protected int nextUid ; protected IHeaderList headerList ; private boolean active ; public VirtualFolder ( FolderItem item , String path ) { } public VirtualFolder ( String name , String type , String path ) { } private void registerWithSource ( ) { } private void unregisterWithSource ( ) { } private void ensureValidFilterElement ( ) { } protected Object generateNextUid ( ) { } public void setNextUid ( int next ) { } public JDialog showFilterDialog ( AbstractMailFrameController frameController ) { } public boolean exists ( Object uid ) throws Exception { } public IHeaderList getHeaderList ( ) throws Exception { } private void revalidateSearch ( ) { VirtualHeader h ; Filter filter = ( ( Filter ) ( getFilter ( ) . clone ( ) ) ) ; FilterRule rule = filter . getFilterRule ( ) ; for ( int i = 0 ; i < ( rule . count ( ) ) ; i ++ ) { FilterCriteria c = rule . get ( i ) ; if ( ! ( c . getTypeString ( ) . equalsIgnoreCase ( "flags" ) ) ) { rule . remove ( i ) ; i -- ; } } if ( ( rule . count ( ) ) == 0 ) { return ; } ICloseableIterator it = headerList . headerIterator ( ) ; while ( it . hasNext ( ) ) { h = ( ( VirtualHeader ) ( it . next ( ) ) ) ; try { if ( ( h . getSrcFolder ( ) . searchMessages ( filter , new Object [ ] { h . getSrcUid ( ) } ) . length ) == 0 ) { it . remove ( ) ; <START_BUG> fireMessageRemoved ( h . getVirtualUid ( ) , null ) ; <END_BUG> } } catch ( Exception e ) { e . printStackTrace ( ) ; } } it . close ( ) ; } public void addSearchToHistory ( ) throws Exception { } protected void applySearch ( ) throws Exception { } AbstractMessageFolder getSourceFolder ( ) { } protected void applySearch ( AbstractMessageFolder parent , Filter filter ) throws Exception { } private boolean isRecursive ( ) { } public DefaultSearchEngine getSearchEngine ( ) { } public Filter getFilter ( ) { } public Object add ( ColumbaHeader header , AbstractMessageFolder source , Object uid ) throws Exception { } public void markMessage ( Object [ ] uids , int variant ) throws Exception { } public void removeMessage ( Object uid ) throws Exception { } public MimeTree getMimePartTree ( Object uid ) throws Exception { } public VirtualHeader getVirtualHeader ( Object virtualUid ) { } public Object [ ] searchMessages ( Filter filter , Object [ ] uids ) throws Exception { } public Object [ ] searchMessages ( Filter filter ) throws Exception { } public String getDefaultChild ( ) { } public static XmlElement getDefaultProperties ( ) { } public boolean tryToGetLock ( Object locker ) { } public void releaseLock ( Object locker ) { } public Object [ ] getUids ( ) throws Exception { } protected Object srcUidToVirtualUid ( IMailFolder srcFolder , Object uid ) { } public Object addMessage ( InputStream in ) throws Exception { } public Object getAttribute ( Object uid , String key ) throws Exception { } public Flags getFlags ( Object uid ) throws Exception { } public Header getHeaderFields ( Object uid , String [ ] keys ) throws Exception { } public InputStream getMessageSourceStream ( Object uid ) throws Exception { } public InputStream getMimePartBodyStream ( Object uid , Integer [ ] address ) throws Exception { } public InputStream getMimePartSourceStream ( Object uid , Integer [ ] address ) throws Exception { } public boolean supportsAddMessage ( ) { } public boolean supportsAddFolder ( String newFolderType ) { } public void innerCopy ( IMailbox destFolder , Object [ ] uids ) throws Exception { } public void setAttribute ( Object uid , String key , Object value ) throws Exception { } public Attributes getAttributes ( Object uid ) throws Exception { } public Object addMessage ( InputStream in , Attributes attributes , Flags flags ) throws Exception { } public boolean supportsMove ( ) { } public Header getAllHeaderFields ( Object uid ) throws Exception { } public void expungeFolder ( ) throws Exception { } private void recursiveExpunge ( AbstractMessageFolder srcFolder ) throws Exception { } public IMailFolder getRootFolder ( ) { } public void messageAdded ( IFolderEvent e ) { } public void messageRemoved ( IFolderEvent e ) { } protected boolean hasFlagsCriteria ( ) { } public void messageFlagChanged ( IFolderEvent e ) { } public void folderPropertyChanged ( IFolderEvent e ) { } public void folderAdded ( IFolderEvent e ) { } public void folderRemoved ( IFolderEvent e ) { } public void activate ( ) throws Exception { } public void deactivate ( ) { } public void removeFolder ( ) throws Exception { } public Object getLastSelection ( ) { } }

Fix:
fireMessageRemoved ( h . getVirtualUid ( ) , h . getFlags ( ) ) ;