Don't know APIs very well, but anyway it looks like in the while
version you check one link in the condition, then request newLink
again in the method body. At the end of the list you check for the
last element not to be null, then ask for one more (which is out of
list bounds).
You should be missing one page each two anyway...

I guess the do-while version catches this with the "tempFeed != null
&& tempFeed.getEntries() != null" check.

Regards
Lorenzo

On Oct 26, 2:16 pm, doc123 <[email protected]> wrote:
> Now I am using GDataI for Java and I tried following code to get Google
> document list
>
> DocumentListFeed tempFeed;
>
> tempFeed = myService.getFeed(feedUrl, DocumentListFeed.class);
>
> After I confirmed this code work without problem, I change code as
> following to be able to feed more than one page entry, but this code
> create Null pointer Exception.
>
> DocumentListFeed tempFeed;
>
> tempFeed = myService.getFeed(feedUrl, DocumentListFeed.class);
>
> resultFeed.getEntries().addAll(tempFeed.getEntries());
>
> while((tempFeed.getNextLink() != null) &&
> (tempFeed.getEntries().size()>0));
>
> {
>
> tempFeed = myService.getFeed(new
> URL(tempFeed.getNextLink().getHref()),DocumentListFeed.class);
>
> resultFeed.getEntries().addAll(tempFeed.getEntries());
>
> }
>
> I confirmed that “tempFeed.getNextLink()” is null. But this is a
> condition to repeat while. I could not understand why this code fail
> and I found suspicious info which related to Java while statement bug
> in a following URL. Is this real bug?
>
> http://java.decompiler.free.fr/?q=node/263after I get info, I changed
> my code as following and confirmed this code works without error.
>
> DocumentListFeed tempFeed = this.resultDocListFeed;
>
> DocumentListFeed resultFeed = new DocumentListFeed();
>
> boolean okToFeed = true;
>
> do
>
> {
>
> if(tempFeed != null && tempFeed.getEntries() != null)
>
> {
>
> if(tempFeed.getNextLink() != null && tempFeed.getEntries().size()>0)
>
> {
>
> tempFeed = this.docServiceClient.getFeed(new
> URL(tempFeed.getNextLink().getHref()),DocumentListFeed.class);
>
> resultFeed.getEntries().addAll(tempFeed.getEntries());
>
> }
>
> else
>
> {
>
> okToFeed = false;
>
> }
> }
>
> else
>
> {
>
> okToFeed = false;
>
> }
> }while(okToFeed == true);

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to