You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Thorsten Schöning <ts...@am-soft.de> on 2016/05/13 18:14:30 UTC

Markupstream.hasMore vs. MarkupStream.next

Hi all,

hasMore: return currentIndex < markup.size();
next:    if (++currentIndex < markup.size()) {...}
me:      while (markupStream.hasMore()) {...}

I get a null element within the while loop which I wouldn't expect to
get. markup.size() is 73, currentIndex 72, so hasMore returns true,
while next returns null, because it already advanced the index on its
check.

Is this a bug or is using hasMore the wrong idiom in this case?

I just followed code in the core codebase, like in Enclosure, the only
difference there is that the result of next is ignored. Of course I
can check for null and such, I just didn't expect such a behavior.

Mit freundlichen Grüßen,

Thorsten Schöning

-- 
Thorsten Schöning       E-Mail: Thorsten.Schoening@AM-SoFT.de
AM-SoFT IT-Systeme      http://www.AM-SoFT.de/

Telefon...........05151-  9468- 55
Fax...............05151-  9468- 88
Mobil..............0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Markupstream.hasMore vs. MarkupStream.next

Posted by Thorsten Schöning <ts...@am-soft.de>.
Guten Tag Thorsten Schöning,
am Freitag, 13. Mai 2016 um 20:14 schrieben Sie:

> Is this a bug or is using hasMore the wrong idiom in this case?

https://issues.apache.org/jira/browse/WICKET-6165

Mit freundlichen Grüßen,

Thorsten Schöning

-- 
Thorsten Schöning       E-Mail: Thorsten.Schoening@AM-SoFT.de
AM-SoFT IT-Systeme      http://www.AM-SoFT.de/

Telefon...........05151-  9468- 55
Fax...............05151-  9468- 88
Mobil..............0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org