Buggy code:
public class IMAPFolder extends AbstractRemoteFolder { private static final Logger LOG = Logger . getLogger ( "org.columba.mail.folder.imap" ) ; private IMAPServer store ; protected boolean existsOnServer = true ; private boolean readOnly ; private PersistantHeaderList headerList ; private boolean lazyFlagSync = false ; public boolean isReadOnly ( ) { } public IMAPFolder ( FolderItem folderItem , String path ) { } public IMAPFolder ( String name , String type , String path ) throws Exception { } public void removeFolder ( ) throws Exception { } public void setName ( String name ) throws Exception { } public IMAPServer getServer ( ) { } public IHeaderList getHeaderList ( ) throws Exception { } public synchronized void ensureFolderIsSynced ( boolean lazy ) throws IOException , Exception , CommandCancelledException , IMAPException { } protected ImapItem getImapItem ( ) { } protected void printStatusMessage ( String message ) { } protected void setProgress ( int progress ) { } protected void setMaximum ( int progress ) { } private void synchronizeHeaderlist ( ) throws IOException , Exception , CommandCancelledException , IMAPException { } private void syncMailboxInfo ( MailboxStatus status ) { } private void fireMessageAdded ( IMAPFlags flags ) { } private void synchronizeFlags ( ) throws IOException , Exception , CommandCancelledException , IMAPException { } protected void setFlags ( Flags [ ] flagsList ) throws Exception { } protected boolean existsRemotely ( String uid , int startIndex , List uidList ) throws Exception { } protected boolean existsLocally ( String uid , PersistantHeaderList list ) throws Exception { } public MimeTree getMimePartTree ( Object uid ) throws Exception { } public void innerCopy ( IMailbox destiny , Object [ ] uids ) throws Exception { } public void markMessage ( Object [ ] uids , int variant ) throws Exception { } public void expungeFolder ( ) throws Exception { } public IColumbaHeader getMessageHeader ( Object uid ) throws Exception { } public String getImapPath ( ) throws IOException , CommandCancelledException , IMAPException { } public static XmlElement getDefaultProperties ( ) { } public boolean tryToGetLock ( Object locker ) { } public void releaseLock ( Object locker ) { } public void addSubfolder ( IMailFolder child ) throws Exception { } public IStatusObservable getObservable ( ) { } public Object addMessage ( InputStream in , Attributes attributes , Flags flags ) throws Exception { PassiveHeaderParserInputStream withHeaderInputStream = new PassiveHeaderParserInputStream ( in ) ; IMAPFlags imapFlags = new IMAPFlags ( flags . getFlags ( ) ) ; Integer uid = getServer ( ) . append ( withHeaderInputStream , imapFlags , this ) ; if ( ( ( Boolean ) ( attributes . get ( "columba.spam" ) ) ) . booleanValue ( ) ) { imapFlags . set ( JUNK , true ) ; getServer ( ) . setFlags ( new Object [ ] { uid } , imapFlags , this ) ; } Header header = withHeaderInputStream . getHeader ( ) ; <START_BUG> IColumbaHeader cHeader = new org . columba . mail . message . ColumbaHeader ( header , attributes , imapFlags ) ; <END_BUG> header . set ( "columba.uid" , uid ) ; headerList . add ( cHeader , uid ) ; fireMessageAdded ( uid ) ; return uid ; } 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 { } public boolean isInboxFolder ( ) { } public boolean isTrashFolder ( ) { } public Object addMessage ( InputStream in ) throws Exception { } public DefaultSearchEngine getSearchEngine ( ) { } public Header getAllHeaderFields ( Object uid ) throws Exception { } public boolean supportsAddFolder ( String folder ) { } public void updateFlag ( IMAPFlags flag ) throws Exception , CommandCancelledException { } public void setReadOnly ( boolean readOnly ) { } public Object [ ] searchMessages ( Filter filter , Object [ ] uids ) throws Exception { } public Object [ ] searchMessages ( Filter filter ) throws Exception { } public void save ( ) throws Exception { } }

Fix:
IColumbaHeader cHeader = new org . columba . mail . message . ColumbaHeader ( header , ( ( Attributes ) ( attributes . clone ( ) ) ) , imapFlags ) ;