for (Iterator iter = searchResp.elementIterator(MailService.E_MSG); iter.hasNext() && bufferIdx < stop;) {
for (Iterator iter = searchResp.elementIterator(); iter.hasNext() && bufferIdx < stop;) {
    private boolean bufferNextHits() throws ServiceException     {        if (mAtEndOfList) {            return false;        }                mBufferStartOffset = mIterOffset;        int chunkSizeToUse = mSearchParams.getLimit();        if (chunkSizeToUse < MIN_BUFFER_CHUNK_SIZE)        	chunkSizeToUse = MIN_BUFFER_CHUNK_SIZE;        if (chunkSizeToUse > 500)        	chunkSizeToUse = 500;        mBufferEndOffset = mBufferStartOffset + chunkSizeToUse;        mHitBuffer = new ArrayList(chunkSizeToUse);                try {            SoapTransport transp = getTransport();                        Element searchElt;            if (isMultipleMailboxes) {                searchElt = new Element.XMLElement(AdminService.SEARCH_MULTIPLE_MAILBOXES_REQUEST);            } else {                searchElt = new Element.XMLElement(MailService.SEARCH_REQUEST);            }                        searchElt.addAttribute(MailService.A_SEARCH_TYPES, "message");            searchElt.addAttribute(MailService.A_SORTBY, mSearchParams.getSortByStr());            searchElt.addAttribute(MailService.A_QUERY_OFFSET, mBufferStartOffset);            searchElt.addAttribute(MailService.A_QUERY_LIMIT, chunkSizeToUse);            searchElt.addAttribute(MailService.E_QUERY, mSearchParams.getQueryStr(), Element.DISP_CONTENT);                        if (isMultipleMailboxes) {                if (isAllMailboxes) {                    Element mbxElt = searchElt.addElement(MailService.E_MAILBOX);                    ParseMailboxID id = ParseMailboxID.serverAll(mServer);                    mbxElt.addAttribute(MailService.A_ID, id.getString());                 } else {                    for (Iterator iter = mMailboxes.iterator(); iter.hasNext();) {                        ParseMailboxID id = (ParseMailboxID)iter.next();                                                //                    assert(!id.isLocal());                        //                    assert(id.getServer().equals(serverID));                                                searchElt.addElement(MailService.E_MAILBOX).addAttribute(MailService.A_ID, id.getString());                    }                }            }                        // call the remote server now!            Element searchResp = transp.invokeWithoutSession(searchElt);                                    int hitOffset = (int) searchResp.getAttributeLong(MailService.A_QUERY_OFFSET);            boolean hasMore = searchResp.getAttributeBool(MailService.A_QUERY_MORE);                        assert(mBufferStartOffset == hitOffset);                        // put these hits into our buffer!            int bufferIdx = 0;            int stop = mBufferEndOffset - mBufferStartOffset;            for (Iterator iter = searchResp.elementIterator(MailService.E_MSG); iter.hasNext() && bufferIdx < stop;) {                Element e = (Element)iter.next();                mHitBuffer.add(bufferIdx++, new ProxiedHit(this, e));            }                        //            // are we at the end of the line here?            //            if ((bufferIdx < stop) || (!hasMore)) {                // update the buffer-end-pointer                 mBufferEndOffset = mBufferStartOffset + bufferIdx;                                if (hasMore) {                    assert(!hasMore); // if bufferIdx < stop then !hasMore should be set...server bug!                }                this.mAtEndOfList = true;            } else {                assert(mBufferEndOffset == mBufferStartOffset+bufferIdx);            }                        assert(mBufferStartOffset <= mIterOffset);                        // OK, we were successful if we managed to buffer the current hit            return (mBufferEndOffset > mIterOffset);        } catch (IOException e) {            throw ServiceException.FAILURE("IOException ", e);        } catch (SoapFaultException e) {            throw ServiceException.FAILURE("SoapFaultException ", e);        }     }