http://kenai.com/bugzilla/show_bug.cgi?id=5820
Bug #: 5820
Summary: Imap search is slow due to SearchException
Classification: Unclassified
Product: javamail
Version: 1.4.5
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P5
Component: imap
AssignedTo: shannon_at_kenai.com
ReportedBy: bhurt42_at_kenai.com
CC: issues_at_javamail.kenai.com
Created attachment 536
-->
http://kenai.com/bugzilla/attachment.cgi?id=536
Proposed patch (generated by hg diff)
I'm hitting the following circumstance: for reasons I have yet to determine, a
SearchException is being thrown down in the bowels of search (I don't *think*
it's a too complicated search). This exception gets caught up in IMAPFolder
(line 1871 of mail/src/main/java/com/sun/mail/imap/IMAPFolder.java), which then
calls the super class Folder.search. Folder.search then iterates over all
messages in the folder, fetching their headers and comparing the headers to the
search. This causes a round-trip out to the server for every email in the
folder, which is a problem if the server is remove (in my case, it's gmail),
and if there are a lot of emails in the folder (which is common, especially for
inbox), and when there are obvious limits that could be placed on the search
(in my case, I only care about the last few months). This is causing my
application to "hang"- it's not actually hung, it's just taking a really,
really long time to complete a search. A search that normally takes a few
seconds has now taken several hours and counting.
It'd be nice if IMAPFolder could just rethrow the exception (wrapping it in a
MessagingException). Then I could just catch the exception and call my own
smart search routine. This could either be done if a given configuration
parameter is set, so the default behavior would remain the same, or just always
done. I've included a patch which always rethrows the exception to demonstrate
what I'm talking about- if you prefer the configuration option, I can generate
that patch as well.
--
Configure bugmail: http://kenai.com/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.