Buggy code:
public class IMAPFolder extends RemoteFolder { private ImapItem item ; private Object aktMessageUid ; private ColumbaMessage aktMessage ; private boolean mailcheck = false ; private IMAPStore store ; protected HeaderList headerList ; protected RemoteHeaderCache cache ; protected boolean existsOnServer ; public IMAPFolder ( FolderItem folderItem ) { } public Object [ ] searchMessages ( Filter filter , Object [ ] uids ) throws Exception { } public Object [ ] searchMessages ( Filter filter ) throws Exception { } public void removeFolder ( ) throws Exception { } public boolean renameFolder ( String name ) throws Exception { } public FolderTreeNode getRootFolder ( ) { } public IMAPStore getStore ( ) { } public HeaderList getHeaderList ( ) throws Exception { } protected void updateFlags ( Flags [ ] flagsList ) { } public void save ( ) throws Exception { } public List synchronize ( HeaderList headerList , List newList ) throws Exception { } protected boolean existsRemotely ( String uid , int startIndex , List uidList ) throws Exception { } protected boolean existsLocally ( String uid , HeaderList list ) throws Exception { } public MimeTree getMimePartTree ( Object uid ) throws Exception { } public MimePart getMimePart ( Object uid , Integer [ ] address ) throws Exception { } public void innerCopy ( Folder destFolder , Object [ ] uids ) throws Exception { } public Object addMessage ( ColumbaMessage message ) throws Exception { } public Object addMessage ( String source ) throws Exception { } public boolean exists ( Object uid ) throws Exception { } protected void markMessage ( Object uid , int variant ) throws Exception { } public void markMessage ( Object [ ] uids , int variant ) throws Exception { } public void removeMessage ( Object uid ) throws Exception { } public Object [ ] getUids ( ) throws Exception { } public void expungeFolder ( ) throws Exception { } public String getMessageSource ( Object uid ) throws Exception { } public ColumbaHeader getMessageHeader ( Object uid ) throws Exception { if ( ( headerList ) == null ) getHeaderList ( ) ; <START_BUG> return ( ( ColumbaHeader ) ( headerList . getHeader ( ( ( String ) ( uid ) ) ) ) ) ; <END_BUG> } public ColumbaMessage getMessage ( Object uid ) throws Exception { } public String getImapPath ( ) { } public static XmlElement getDefaultProperties ( ) { } public boolean tryToGetLock ( Object locker ) { } public void releaseLock ( ) { } public IMAPFolder ( String name , String type ) throws Exception { } public void addSubfolder ( FolderTreeNode child ) throws Exception { } public StatusObservable getObservable ( ) { } 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 getMimePartSourceStream ( Object uid , Integer [ ] address ) throws Exception { } public InputStream getMimePartBodyStream ( Object uid , Integer [ ] address ) throws Exception { } }

Fix:
return ( ( ColumbaHeader ) ( headerList . getHeader ( uid ) ) ) ;