Re: [appengine-java] Re: Java while statement bug on GAE server?
Wow Thank you Don you have a very keen eye. On Wed, Oct 27, 2010 at 12:53 AM, l.denardo lorenzo.dena...@gmail.comwrote: I need a good pair of glasses :-) On Oct 26, 5:42 pm, Don Schwarz schwa...@google.com wrote: Yes, it's a bug in your code: while(tempFlag == true); Note the semicolon. Try removing it. On Tue, Oct 26, 2010 at 10:22 AM, doc123 doc.u...@gmail.com wrote: Sorry to use specific sample code. So I tried more basic following code. try { int i =0; boolean tempFlag = false; while(tempFlag == true); { i++; out.println(tempFlag + i + := + tempFlag); tempFlag = false; } } catch(Exception e) { out.println(Error + e.toString()); } what I got is tempFlag1:=false but out.print is within a while(tempFlag == true) bock. I think this is bug. -- 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.comgoogle-appengine-java%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en. -- 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.comgoogle-appengine-java%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en. -- 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] Re: Java while statement bug on GAE server?
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 doc.u...@gmail.com 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] Re: Java while statement bug on GAE server?
Sorry to use specific sample code. So I tried more basic following code. try { int i =0; boolean tempFlag = false; while(tempFlag == true); { i++; out.println(tempFlag + i + := + tempFlag); tempFlag = false; } } catch(Exception e) { out.println(Error + e.toString()); } what I got is tempFlag1:=false but out.print is within a while(tempFlag == true) bock. I think this is bug. -- 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] Re: Java while statement bug on GAE server?
Really looks like a bug. Test condition should fail without printing anything, in fact. Sorry for my misleading answer, and thanks for sharing this. Lorenzo On Oct 26, 5:22 pm, doc123 doc.u...@gmail.com wrote: Sorry to use specific sample code. So I tried more basic following code. try { int i =0; boolean tempFlag = false; while(tempFlag == true); { i++; out.println(tempFlag + i + := + tempFlag); tempFlag = false; } } catch(Exception e) { out.println(Error + e.toString()); } what I got is tempFlag1:=false but out.print is within a while(tempFlag == true) bock. I think this is bug. -- 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
Re: [appengine-java] Re: Java while statement bug on GAE server?
Yes, it's a bug in your code: while(tempFlag == true); Note the semicolon. Try removing it. On Tue, Oct 26, 2010 at 10:22 AM, doc123 doc.u...@gmail.com wrote: Sorry to use specific sample code. So I tried more basic following code. try { int i =0; boolean tempFlag = false; while(tempFlag == true); { i++; out.println(tempFlag + i + := + tempFlag); tempFlag = false; } } catch(Exception e) { out.println(Error + e.toString()); } what I got is tempFlag1:=false but out.print is within a while(tempFlag == true) bock. I think this is bug. -- 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en. -- 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] Re: Java while statement bug on GAE server?
I need a good pair of glasses :-) On Oct 26, 5:42 pm, Don Schwarz schwa...@google.com wrote: Yes, it's a bug in your code: while(tempFlag == true); Note the semicolon. Try removing it. On Tue, Oct 26, 2010 at 10:22 AM, doc123 doc.u...@gmail.com wrote: Sorry to use specific sample code. So I tried more basic following code. try { int i =0; boolean tempFlag = false; while(tempFlag == true); { i++; out.println(tempFlag + i + := + tempFlag); tempFlag = false; } } catch(Exception e) { out.println(Error + e.toString()); } what I got is tempFlag1:=false but out.print is within a while(tempFlag == true) bock. I think this is bug. -- 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en. -- 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.