classpath-inetlib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Classpath-inetlib] IMAP search problem with no matches:


From: Chris Burdess
Subject: Re: [Classpath-inetlib] IMAP search problem with no matches:
Date: Wed, 20 Apr 2005 18:52:37 +0100

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]