Buggy code:
public class IMAPFolder extends AbstractRemoteFolder { private static final Logger LOG = Logger . getLogger ( "org.columba.mail.folder.imap" ) ; private Object aktMessageUid ; private IColumbaMessage aktMessage ; private boolean mailcheck = false ; private IMAPServer store ; protected IHeaderList headerList ; protected boolean existsOnServer = true ; private IHeaderListStorage attributeStorage ; private boolean readOnly ; 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 { } protected ImapItem getImapItem ( ) { } protected void printStatusMessage ( String message ) { } public void synchronizeHeaderlist ( ) throws IOException , Exception , CommandCancelledException , IMAPException { } public void synchronizeFlags ( ) throws IOException , Exception , CommandCancelledException , IMAPException { headerList = super . getHeaderList ( ) ; printStatusMessage ( MailResourceLoader . getString ( "statusbar" , "message" , "sync_flags" ) ) ; SearchKey unseenKey = new SearchKey ( SearchKey . UNSEEN ) ; List remoteUnseenUids = Arrays . asList ( getServer ( ) . search ( unseenKey , this ) ) ; SearchKey flaggedKey = new SearchKey ( SearchKey . FLAGGED ) ; List remoteFlaggedUids = Arrays . asList ( getServer ( ) . search ( flaggedKey , this ) ) ; SearchKey deletedKey = new SearchKey ( SearchKey . DELETED ) ; List remoteDeletedUids = Arrays . asList ( getServer ( ) . search ( deletedKey , this ) ) ; SearchKey junkKey = new SearchKey ( SearchKey . KEYWORD , "JUNK" ) ; List remoteJunkUids = Arrays . asList ( getServer ( ) . search ( junkKey , this ) ) ; Enumeration uids = headerList . keys ( ) ; MailboxInfo testInfo = new MailboxInfo ( ) ; while ( uids . hasMoreElements ( ) ) { Object uid = uids . nextElement ( ) ; IColumbaHeader header = headerList . get ( uid ) ; Flags flag = header . getFlags ( ) ; testInfo . incExists ( ) ; flag . setSeen ( ( ( Collections . binarySearch ( remoteUnseenUids , uid ) ) < 0 ) ) ; if ( ! ( flag . getSeen ( ) ) ) { testInfo . incUnseen ( ) ; } flag . setDeleted ( ( ( Collections . binarySearch ( remoteDeletedUids , uid ) ) >= 0 ) ) ; flag . setFlagged ( ( ( Collections . binarySearch ( remoteFlaggedUids , uid ) ) >= 0 ) ) ; <START_BUG> header . set ( "columba.spam" , new Boolean ( ( ( Collections . binarySearch ( remoteJunkUids , uid ) ) >= 0 ) ) ) ; <END_BUG> fireMessageFlagChanged ( uid ) ; } if ( ! ( messageFolderInfo . equals ( testInfo ) ) ) { messageFolderInfo . setExists ( testInfo . getExists ( ) ) ; messageFolderInfo . setUnseen ( testInfo . getUnseen ( ) ) ; messageFolderInfo . setRecent ( testInfo . getRecent ( ) ) ; fireFolderPropertyChanged ( ) ; } } protected void setFlags ( Flags [ ] flagsList ) { } public void save ( ) throws Exception { } private List extractUids ( IHeaderList headerList ) { } 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 ( 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 IColumbaMessage getMessage ( 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 StatusObservable 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 IHeaderListStorage getHeaderListStorage ( ) { } public DefaultSearchEngine getSearchEngine ( ) { } public Header getAllHeaderFields ( Object uid ) throws Exception { } public boolean supportsAddFolder ( IMailFolder folder ) { } public void updateFlag ( IMAPFlags flag ) throws IOException , CommandCancelledException , IMAPException { } public void setReadOnly ( boolean readOnly ) { } class RemoteHeaderListStorage extends AbstractHeaderListStorage { protected AbstractHeaderCache headerCache ; private IMAPFolder folder ; public RemoteHeaderListStorage ( IMAPFolder folder ) { } public AbstractHeaderCache getHeaderCacheInstance ( ) { } } }

Fix:
header . getAttributes ( ) . put ( "columba.spam" , new Boolean ( ( ( Collections . binarySearch ( remoteJunkUids , uid ) ) >= 0 ) ) ) ;