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 , boolean forceSelect ) 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 { IMAPFolder destFolder = ( ( IMAPFolder ) ( destiny ) ) ; IHeaderList srcHeaderList = getHeaderList ( ) ; IHeaderList destHeaderList = destFolder . getHeaderList ( ) ; Object [ ] destUids = getServer ( ) . copy ( destFolder , uids , this ) ; if ( ( destUids . length ) != ( uids . length ) ) { IMAPFolder . LOG . warning ( "Some<seq2seq4repair_space>messages<seq2seq4repair_space>could<seq2seq4repair_space>not<seq2seq4repair_space>be<seq2seq4repair_space>copied<seq2seq4repair_space>because<seq2seq4repair_space>they<seq2seq4repair_space>do<seq2seq4repair_space>not<seq2seq4repair_space>exist<seq2seq4repair_space>anymore!" ) ; } int j = 0 ; for ( int i = 0 ; i < ( uids . length ) ; i ++ ) { <START_BUG> IColumbaHeader destHeader = new org . columba . mail . message . ColumbaHeader ( srcHeaderList . get ( uids [ i ] ) ) ; <END_BUG> destHeader . set ( "columba.uid" , destUids [ j ] ) ; destHeaderList . add ( destHeader , destUids [ j ] ) ; IMAPFlags flags = new IMAPFlags ( destHeader . getFlags ( ) . getFlags ( ) ) ; flags . setUid ( destUids [ j ] ) ; destFolder . fireMessageAdded ( flags ) ; j ++ ; } } 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 { } 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 destHeader = ( ( IColumbaHeader ) ( srcHeaderList . get ( uids [ i ] ) . clone ( ) ) ) ;