Description
At the moment we try to parse the uid file and split lines on "gaps" to read the uid list. It happened to me that I had a corrupted line in the file (don't know yet why) which raised a IndexOutOfBoundException later (because the gap position was detected as -1). It would be nice if we throw an checked exception in this cases which contains the file + linenumber which raised this problems.
This was the exception:
INFO | jvm 1 | 2011/04/03 21:25:36 | java.lang.StringIndexOutOfBoundsException: String index out of range: -1
INFO | jvm 1 | 2011/04/03 21:25:36 | at java.lang.String.substring(String.java:1949)
INFO | jvm 1 | 2011/04/03 21:25:36 | at org.apache.james.mailbox.maildir.MaildirFolder.updateUidFile(MaildirFolder.java:508)
INFO | jvm 1 | 2011/04/03 21:25:36 | at org.apache.james.mailbox.maildir.MaildirFolder.getUidMap(MaildirFolder.java:323)
INFO | jvm 1 | 2011/04/03 21:25:36 | at org.apache.james.mailbox.maildir.mail.MaildirMessageMapper.searchMailbox(MaildirMessageMapper.java:403)
INFO | jvm 1 | 2011/04/03 21:25:36 | at org.apache.james.mailbox.store.StoreMessageManager.search(StoreMessageManager.java:581)
INFO | jvm 1 | 2011/04/03 21:25:36 | at org.apache.james.imap.processor.AbstractSelectionProcessor.createNewSelectedMailbox(AbstractSelectionProcessor.java:205)
INFO | jvm 1 | 2011/04/03 21:25:36 | at org.apache.james.imap.processor.AbstractSelectionProcessor.selectMailbox(AbstractSelectionProcessor.java:188)
INFO | jvm 1 | 2011/04/03 21:25:36 | at org.apache.james.imap.processor.AbstractSelectionProcessor.doProcess(AbstractSelectionProcessor.java:83)
INFO | jvm 1 | 2011/04/03 21:25:36 | at org.apache.james.imap.processor.AbstractSelectionProcessor.doProcess(AbstractSelectionProcessor.java:50)
INFO | jvm 1 | 2011/04/03 21:25:36 | at org.apache.james.imap.processor.AbstractMailboxProcessor.doProcess(AbstractMailboxProcessor.java:95)
INFO | jvm 1 | 2011/04/03 21:25:36 | at org.apache.james.imap.processor.AbstractMailboxProcessor.process(AbstractMailboxProcessor.java:81)
INFO | jvm 1 | 2011/04/03 21:25:36 | at org.apache.james.imap.processor.AbstractMailboxProcessor.doProcess(AbstractMailboxProcessor.java:74)
INFO | jvm 1 | 2011/04/03 21:25:36 | at org.apache.james.imap.processor.AbstractMailboxProcessor.doProcess(AbstractMailboxProcessor.java:54)
INFO | jvm 1 | 2011/04/03 21:25:36 | at org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:51)
INFO | jvm 1 | 2011/04/03 21:25:36 | at org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:53)
INFO | jvm 1 | 2011/04/03 21:25:36 | at org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:53)
INFO | jvm 1 | 2011/04/03 21:25:36 | at org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:53)
INFO | jvm 1 | 2011/04/03 21:25:36 | at org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:53)
INFO | jvm 1 | 2011/04/03 21:25:36 | at org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:53)
INFO | jvm 1 | 2011/04/03 21:25:36 | at org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:53)
INFO | jvm 1 | 2011/04/03 21:25:36 | at org.apache.james.imapserver.netty.ImapChannelUpstreamHandler.messageReceived(ImapChannelUpstreamHandler.java:167)
INFO | jvm 1 | 2011/04/03 21:25:36 | at org.jboss.netty.handler.stream.ChunkedWriteHandler.handleUpstream(ChunkedWriteHandler.java:148)
INFO | jvm 1 | 2011/04/03 21:25:36 | at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:302)
INFO | jvm 1 | 2011/04/03 21:25:36 | at org.jboss.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:317)
INFO | jvm 1 | 2011/04/03 21:25:36 | at org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:299)
INFO | jvm 1 | 2011/04/03 21:25:36 | at org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:216)
INFO | jvm 1 | 2011/04/03 21:25:36 | at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:302)
INFO | jvm 1 | 2011/04/03 21:25:36 | at org.jboss.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:317)
INFO | jvm 1 | 2011/04/03 21:25:36 | at org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:299)
INFO | jvm 1 | 2011/04/03 21:25:36 | at org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:216)
INFO | jvm 1 | 2011/04/03 21:25:36 | at org.jboss.netty.handler.timeout.IdleStateHandler.messageReceived(IdleStateHandler.java:276)
INFO | jvm 1 | 2011/04/03 21:25:36 | at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274)
INFO | jvm 1 | 2011/04/03 21:25:36 | at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261)
INFO | jvm 1 | 2011/04/03 21:25:36 | at org.jboss.netty.channel.socket.oio.OioWorker.run(OioWorker.java:90)
INFO | jvm 1 | 2011/04/03 21:25:36 | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
INFO | jvm 1 | 2011/04/03 21:25:36 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
INFO | jvm 1 | 2011/04/03 21:25:36 | at java.lang.Thread.run(Thread.java:636)