You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Thorsten Schöning (JIRA)" <ji...@apache.org> on 2016/05/15 18:21:12 UTC
[jira] [Updated] (WICKET-6165) Inconsistent behavior of
Markupstream.hasMore vs. MarkupStream.next.
[ https://issues.apache.org/jira/browse/WICKET-6165?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Thorsten Schöning updated WICKET-6165:
--------------------------------------
Description:
{CODE}
hasMore: return currentIndex < markup.size();
next: if (++currentIndex < markup.size()) {...}
me: while (markupStream.hasMore()) {...}
{CODE}
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 during its check. "hasMore" saying "yes" while "next" saying "no" seems inconsistent to me, even though one can check the return value of "next" against "null".
Shouldn't "next" use
{CODE}
if (currentIndex++ < markup.size()) {...}
{CODE}
to be in line with "hasMore"? Or more better directly call "hasMore" for the check itself to have only one single consistent implementation of the check?
was:
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 during its check. "hasMore" saying "yes" while "next" saying "no" seems inconsistent to me, even though one can check the return value of "next" against "null".
Shouldn't "next" use
if (currentIndex++ < markup.size()) {...}
to be in line with "hasMore"? Or more better directly call "hasMore" for the check itself to have only one single consistent implementation of the check?
> Inconsistent behavior of Markupstream.hasMore vs. MarkupStream.next.
> --------------------------------------------------------------------
>
> Key: WICKET-6165
> URL: https://issues.apache.org/jira/browse/WICKET-6165
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 7.3.0
> Reporter: Thorsten Schöning
> Priority: Minor
>
> {CODE}
> hasMore: return currentIndex < markup.size();
> next: if (++currentIndex < markup.size()) {...}
> me: while (markupStream.hasMore()) {...}
> {CODE}
> 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 during its check. "hasMore" saying "yes" while "next" saying "no" seems inconsistent to me, even though one can check the return value of "next" against "null".
> Shouldn't "next" use
> {CODE}
> if (currentIndex++ < markup.size()) {...}
> {CODE}
> to be in line with "hasMore"? Or more better directly call "hasMore" for the check itself to have only one single consistent implementation of the check?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)