component without close tag fails with "Unable to find close tag for" if it is 
the last componet on page
--------------------------------------------------------------------------------------------------------

                 Key: WICKET-4136
                 URL: https://issues.apache.org/jira/browse/WICKET-4136
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.5.1
            Reporter: Kent Tong
            Priority: Minor


A simple page with the following markup will fail:

<html>
<img wicket:id="photo">
</html>

but this one will work:

<html>
<img wicket:id="photo">
<span wicket:id="label" />
</html>

I believe the bug is in the code below:

        public MarkupFragment(final IMarkupFragment markup, final int 
startIndex)
        {
                if (...) 
                {
                   ...
                }
                else if (startTag.hasNoCloseTag())
                {
                        for (endIndex = startIndex + 1; endIndex < 
markup.size(); endIndex++)
                        {
                                MarkupElement elem = markup.get(endIndex);
                                if (elem instanceof ComponentTag)  // It looks 
for another component tag to indicate the end of the body, but fails if it is 
the last one
                                {
                                        endIndex--;
                                        break;
                                }
                        }
                }
                else
                {
                   ...
                }

                if (endIndex >= markup.size())
                {
                        throw new MarkupException("Unable to find close tag 
for: '" + startTag.toString() +
                                "' in " + 
getRootMarkup().getMarkupResourceStream().toString());
                }
        }


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to