} catch (AuthenticationFailedException e) {
throw new MailAuthenticationException(e);
}
}
protected List<EmailMessage> getEmailMessages(Folder mailFolder, int pageStart,
<BUG>int messageCount) throws MessagingException, IOException, ScanException, PolicyException {
</BUG>
int totalMessageCount = mailFolder.getMessageCount();
int start = Math.max(1, totalMessageCount - pageStart - (messageCount - 1));
int end = Math.max(totalMessageCount - pageStart, 1);

} catch (AuthenticationFailedException e) {
throw new MailAuthenticationException(e);
}
}
protected List<EmailMessage> getEmailMessages(Folder mailFolder, int pageStart,
int messageCount, Session session) throws MessagingException, IOException, ScanException, PolicyException {
int totalMessageCount = mailFolder.getMessageCount();
int start = Math.max(1, totalMessageCount - pageStart - (messageCount - 1));
int end = Math.max(totalMessageCount - pageStart, 1);
