[ 
https://issues.apache.org/jira/browse/WICKET-6165?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15850973#comment-15850973
 ] 

ASF subversion and git services commented on WICKET-6165:
---------------------------------------------------------

Commit c21b09bc83e31311f06e23d4871f48f19c57a7e0 in wicket's branch 
refs/heads/wicket-7.x from Pedro Henrique Oliveira dos Santos
[ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=c21b09b ]

WICKET-6165 addind and using MarkupStream#isCurrentIndexInsideTheStream instead 
of MarkupStream#hasMore


> 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
>            Assignee: Pedro Santos
>            Priority: Minor
>             Fix For: 8.0.0
>
>         Attachments: HtmlHandler.java.patch, MarkupStream.java.patch, 
> MarkupStream.java.patch
>
>
> {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.15#6346)

Reply via email to