Buggy code:
public class IMAPRootFolder extends AbstractFolder implements RootFolder , IMAPServerOwner { private static final Logger LOG = Logger . getLogger ( "org.columba.mail.folder.imap" ) ; private static final int ONE_SECOND = 1000 ; private static final String [ ] SPECIAL_FOLDER_NAMES = new String [ ] { "trash" , "drafts" , "templates" , "sent" } ; private IMAPProtocol imap ; private boolean fetch = false ; private StringBuffer cache ; private int state ; private List lsubList ; private AccountItem accountItem ; private IMAPServer server ; private String parentPath ; protected StatusObservable observable ; public IMAPRootFolder ( FolderItem folderItem , String path ) { } public IMAPRootFolder ( AccountItem accountItem , String path ) { } public IMAPRootFolder ( String name , String type ) { } public String getDefaultChild ( ) { } public StatusObservable getObservable ( ) { } protected void syncFolder ( AbstractFolder parent , String name , ListInfo info ) throws Exception { if ( ( ( name . indexOf ( server . getDelimiter ( ) ) ) != ( - 1 ) ) && ( ( name . indexOf ( server . getDelimiter ( ) ) ) != ( ( name . length ( ) ) - 1 ) ) ) { String subchild = name . substring ( 0 , name . indexOf ( server . getDelimiter ( ) ) ) ; AbstractFolder subFolder = ( ( AbstractFolder ) ( parent . findChildWithName ( subchild , false ) ) ) ; if ( subFolder == null ) { subFolder = new IMAPFolder ( subchild , "IMAPFolder" , getParentPath ( ) ) ; parent . add ( subFolder ) ; parent . getConfiguration ( ) . getRoot ( ) . addElement ( subFolder . getConfiguration ( ) . getRoot ( ) ) ; FolderTreeModel . getInstance ( ) . insertNodeInto ( subFolder , parent , parent . getIndex ( subFolder ) ) ; ( ( IMAPFolder ) ( subFolder ) ) . existsOnServer = true ; subFolder . getConfiguration ( ) . setString ( "selectable" , "false" ) ; } else { if ( ! ( ( ( IMAPFolder ) ( subFolder ) ) . existsOnServer ) ) { ( ( IMAPFolder ) ( subFolder ) ) . existsOnServer = true ; subFolder . getConfiguration ( ) . setString ( "selectable" , "false" ) ; } } syncFolder ( subFolder , name . substring ( ( ( name . indexOf ( server . getDelimiter ( ) ) ) + 1 ) ) , info ) ; } else { <START_BUG> AbstractFolder subFolder = ( ( AbstractFolder ) ( parent . findChildWithName ( name , false ) ) ) ; <END_BUG> if ( subFolder == null ) { subFolder = new IMAPFolder ( name , "IMAPFolder" , getParentPath ( ) ) ; parent . add ( subFolder ) ; parent . getConfiguration ( ) . getRoot ( ) . addElement ( subFolder . getConfiguration ( ) . getRoot ( ) ) ; FolderTreeModel . getInstance ( ) . insertNodeInto ( subFolder , parent , parent . getIndex ( subFolder ) ) ; } ( ( IMAPFolder ) ( subFolder ) ) . existsOnServer = true ; if ( info . getParameter ( NOSELECT ) ) { subFolder . getConfiguration ( ) . setString ( "selectable" , "false" ) ; } else { subFolder . getConfiguration ( ) . setString ( "selectable" , "true" ) ; } if ( ( info . getParameter ( NOINFERIORS ) ) && ( ( info . getDelimiter ( ) ) != null ) ) { subFolder . getConfiguration ( ) . setString ( "noinferiors" , "true" ) ; } else { subFolder . getConfiguration ( ) . setString ( "noinferiors" , "false" ) ; } } } protected void markAllSubfoldersAsExistOnServer ( AbstractFolder parent , boolean value ) { } public void removeNotMarkedSubfolders ( AbstractFolder parent ) throws Exception { } public void findSpecialFolders ( ) { } public void syncSubscribedFolders ( ) { } public IMAPServer getServer ( ) { } public void updateConfiguration ( ) { } public Object [ ] searchMessages ( Filter filter , Object [ ] uids ) throws Exception { } public Object [ ] searchMessages ( Filter filter ) throws Exception { } public AccountItem getAccountItem ( ) { } public void addSubfolder ( AbstractFolder child ) throws Exception { } public void save ( ) throws Exception { } public AbstractFolder getTrashFolder ( ) { } public AbstractFolder getInboxFolder ( ) { } public String getParentPath ( ) { } public boolean supportsAddFolder ( String folder ) { } }

Fix:
AbstractFolder subFolder = ( ( AbstractFolder ) ( parent . findChildWithName ( name , false , IMAPFolder . class ) ) ) ;