Buggy code:
public class IMAPServer implements IMAPListener { private static final int NOOP_INTERVAL = 30000 ; private static final Logger LOG = Logger . getLogger ( "org.columba.mail.imap" ) ; private static final Charset UTF8 = Charset . forName ( "UTF-8" ) ; private static final Charset DEFAULT = Charset . forName ( System . getProperty ( "file.encoding" ) ) ; private IMAPFolder selectedFolder ; private MailboxStatus selectedStatus ; private String delimiter ; private IMAPProtocol protocol ; private ImapItem item ; private IMAPRootFolder imapRoot ; private MimeTree aktMimeTree ; private Object aktMessageUid ; private MailboxInfo messageFolderInfo ; private boolean firstLogin ; boolean usingSSL ; String [ ] capabilities ; private long lastNoop ; private boolean updatesEnabled ; public IMAPServer ( ImapItem item , IMAPRootFolder root ) { } protected StatusObservable getObservable ( ) { } protected void printStatusMessage ( String message ) { } public String getDelimiter ( ) throws IOException , CommandCancelledException , IMAPException { } public void logout ( ) throws Exception { } private void openConnection ( ) throws IOException , CommandCancelledException , IMAPException { } public List checkSupportedAuthenticationMethods ( ) throws IOException { } private String [ ] getCapas ( String command ) throws IOException { } public boolean isSupported ( String command ) throws IOException { } private void fetchCapas ( ) throws IOException { } private int getLoginMethod ( ) throws IOException , CommandCancelledException { } private void login ( ) throws IOException , CommandCancelledException , IMAPException { } protected void ensureSelectedState ( IMAPFolder folder ) throws IOException , CommandCancelledException , IMAPException { } public MailboxStatus getStatus ( IMAPFolder folder ) throws IOException , CommandCancelledException , IMAPException { } protected String fetchDelimiter ( ) throws IOException , CommandCancelledException , IMAPException { } public ListInfo [ ] list ( String reference , String pattern ) throws Exception { } public Integer append ( InputStream messageSource , IMAPFolder folder ) throws Exception { } public Integer append ( InputStream messageSource , IMAPFlags flags , IMAPFolder folder ) throws Exception { } public void createMailbox ( String mailboxName , IMAPFolder folder ) throws IOException , CommandCancelledException , IMAPException { } public void deleteFolder ( String path ) throws Exception { } public void renameFolder ( String oldMailboxName , String newMailboxName ) throws IOException , CommandCancelledException , IMAPException { } public void subscribeFolder ( String mailboxName ) throws IOException , CommandCancelledException , IMAPException { } public void unsubscribeFolder ( String mailboxName ) throws IOException , CommandCancelledException , IMAPException { } public List fetchUIDList ( IMAPFolder folder ) throws IOException , CommandCancelledException , IMAPException { } public void expunge ( IMAPFolder folder ) throws IOException , CommandCancelledException , IMAPException { } public Integer [ ] copy ( IMAPFolder destFolder , Object [ ] uids , IMAPFolder folder ) throws Exception { } public IMAPFlags [ ] fetchFlagsList ( IMAPFolder folder ) throws IOException , CommandCancelledException , IMAPException { } public Integer [ ] fetchUids ( SequenceSet set , IMAPFolder folder ) throws IOException , CommandCancelledException , IMAPException { } public IMAPFlags [ ] fetchFlagsListStartFrom ( int startIdx , IMAPFolder folder ) throws IOException , CommandCancelledException , IMAPException { } public NamespaceCollection fetchNamespaces ( ) throws IOException , CommandCancelledException , IMAPException { } private ColumbaHeader parseMessage ( String headerString ) { } public void fetchHeaderList ( IHeaderList headerList , List list , IMAPFolder folder ) throws Exception { try { ensureSelectedState ( folder ) ; <START_BUG> String [ ] headerFields = CachedHeaderfields . getCachedHeaderfields ( ) ; <END_BUG> IMAPHeader [ ] headers = protocol . uidFetchHeaderFields ( new SequenceSet ( list ) , headerFields ) ; for ( int i = 0 ; i < ( headers . length ) ; i ++ ) { ColumbaHeader header = new ColumbaHeader ( headers [ i ] . getHeader ( ) ) ; Object uid = headers [ i ] . getUid ( ) ; header . set ( "columba.uid" , uid ) ; header . set ( "columba.size" , headers [ i ] . getSize ( ) ) ; String contentType = ( ( String ) ( header . get ( "Content-Type" ) ) ) ; header . set ( "columba.attachment" , header . hasAttachments ( ) ) ; String messageID = ( ( String ) ( header . get ( "Message-Id" ) ) ) ; if ( messageID != null ) header . set ( "Message-ID" , header . get ( "Message-Id" ) ) ; headerList . add ( header , uid ) ; } } catch ( IMAPDisconnectedException e ) { fetchHeaderList ( headerList , list , folder ) ; } } protected void ensureConnectedState ( ) throws IOException , CommandCancelledException , IMAPException { } protected void ensureLoginState ( ) throws IOException , CommandCancelledException , IMAPException { } public MimeTree getMimeTree ( Object uid , IMAPFolder folder ) throws IOException , CommandCancelledException , IMAPException { } public InputStream getMimePartBodyStream ( Object uid , Integer [ ] address , IMAPFolder folder ) throws IOException , CommandCancelledException , IMAPException { } public Header getHeaders ( Object uid , String [ ] keys , IMAPFolder folder ) throws IOException , CommandCancelledException , IMAPException { } public Header getAllHeaders ( Object uid , IMAPFolder folder ) throws IOException , CommandCancelledException , IMAPException { } public InputStream getMimePartSourceStream ( Object uid , Integer [ ] address , IMAPFolder folder ) throws IOException , CommandCancelledException , IMAPException { } public InputStream getMessageSourceStream ( Object uid , IMAPFolder folder ) throws IOException , CommandCancelledException , IMAPException { } public void markMessage ( Object [ ] uids , int variant , IMAPFolder folder ) throws IOException , CommandCancelledException , IMAPException { } public void setFlags ( Object [ ] uids , IMAPFlags flags , IMAPFolder folder ) throws IOException , CommandCancelledException , IMAPException { } public List search ( Object [ ] uids , FilterRule filterRule , IMAPFolder folder ) throws Exception { } public int getIndex ( Integer uid , IMAPFolder folder ) throws IOException , CommandCancelledException , IMAPException { }

Fix:
String [ ] headerFields = CachedHeaderfields . getDefaultHeaderfields ( ) ;