In MaildirFolder.getMessagesByUID():
if (Arrays.binarySearch(sortedUidArray, uid) >= 0) {
msgs[i] = (Message) uniqToMessageMap.get(uniq);
}
should be using the result from binarySearch() as the
index into msgs[] as follows:
int j;
if ((j = Arrays.binarySearch(sortedUidArray, uid)) >= 0) {
msgs[j] = (Message) uniqToMessageMap.get(uniq);
}
Otherwise calling getMessageByUID() throws
ArrayIndexOutOfBoundsException.