Robert Mitchell wrote:
IMAPConnection.search can give a null pointer exception if the IMAP server returns no matches.� The sequence involved is:

imap: > A8 SEARCH UNSEEN
imap: < * SEARCH
imap: < A8 OK SEARCH completed

The problem is that IMAPResponse.getText returns null on the first response.� To fix this I changed the following lines in IMAPConnection..search:

������� if (response.isUntagged())
��������� {
����������� if (id == SEARCH)
������������� {
��������������� String text = response.getText();
��������������� try
����������������� {
to check if text is null before parsing it:

������� if (response.isUntagged())
��������� {
����������� if (id == SEARCH)
������������� {
��������������� String text = response.getText();
��������������� if (text == null) continue;
��������������� try
����������������� {

The "continue" operation may not be the best way to skip the parsing, but it works and made for the least number of lines changed.

Thanks; I've applied this patch. -- Chris Burdess



_______________________________________________
Classpath-inetlib mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-inetlib

Reply via email to