You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Phil McCarthy (JIRA)" <ta...@jakarta.apache.org> on 2006/12/08 11:14:20 UTC

[jira] Created: (TAPESTRY-1177) ForBean can cause NullPointerException when rendered without a template

ForBean can cause NullPointerException when rendered without a template
-----------------------------------------------------------------------

                 Key: TAPESTRY-1177
                 URL: http://issues.apache.org/jira/browse/TAPESTRY-1177
             Project: Tapestry
          Issue Type: Bug
          Components: Framework
    Affects Versions: 4.1.1
            Reporter: Phil McCarthy
            Priority: Minor


Create a component which doesn't implement ITemplateComponent. In the component specification, declare a For component, but don't bind its optional "element" parameter. Call the For component's render() method.

Stacktrace is:

java.lang.NullPointerException
Stack Trace:

    * org.apache.tapestry.markup.MarkupWriterImpl.end(MarkupWriterImpl.java:261)
    * org.apache.tapestry.components.ForBean.renderComponent(ForBean.java:183) 
    * ...

The problem is caused by line 140 of ForBean.java:

String element = HiveMind.isNonBlank(getElement()) ? getElement() : getTemplateTagName();

Because no element binding was specified, and there's no template, this returns null. The markup writer pushes the null value when begin(null) is called, then barfs when it is popped in end().

Fix is to not call loopWriter.begin()/end() when element is null.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Updated: (TAPESTRY-1177) ForBean can cause NullPointerException when rendered without a template

Posted by "Phil McCarthy (JIRA)" <ta...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/TAPESTRY-1177?page=all ]

Phil McCarthy updated TAPESTRY-1177:
------------------------------------

    Attachment: ForBean.java.tapestry-1177.patch

Only surround For loop's body in a tag if element is non-null

> ForBean can cause NullPointerException when rendered without a template
> -----------------------------------------------------------------------
>
>                 Key: TAPESTRY-1177
>                 URL: http://issues.apache.org/jira/browse/TAPESTRY-1177
>             Project: Tapestry
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: 4.1.1
>            Reporter: Phil McCarthy
>            Priority: Minor
>         Attachments: ForBean.java.tapestry-1177.patch
>
>
> Create a component which doesn't implement ITemplateComponent. In the component specification, declare a For component, but don't bind its optional "element" parameter. Call the For component's render() method.
> Stacktrace is:
> java.lang.NullPointerException
> Stack Trace:
>     * org.apache.tapestry.markup.MarkupWriterImpl.end(MarkupWriterImpl.java:261)
>     * org.apache.tapestry.components.ForBean.renderComponent(ForBean.java:183) 
>     * ...
> The problem is caused by line 140 of ForBean.java:
> String element = HiveMind.isNonBlank(getElement()) ? getElement() : getTemplateTagName();
> Because no element binding was specified, and there's no template, this returns null. The markup writer pushes the null value when begin(null) is called, then barfs when it is popped in end().
> Fix is to not call loopWriter.begin()/end() when element is null.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Updated: (TAPESTRY-1177) ForBean can cause NullPointerException when rendered without a template

Posted by "Jesse Kuhnert (JIRA)" <ta...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/TAPESTRY-1177?page=all ]

Jesse Kuhnert updated TAPESTRY-1177:
------------------------------------

    Fix Version/s: 4.1.1
         Assignee: Jesse Kuhnert

> ForBean can cause NullPointerException when rendered without a template
> -----------------------------------------------------------------------
>
>                 Key: TAPESTRY-1177
>                 URL: http://issues.apache.org/jira/browse/TAPESTRY-1177
>             Project: Tapestry
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: 4.1.1
>            Reporter: Phil McCarthy
>         Assigned To: Jesse Kuhnert
>            Priority: Minor
>             Fix For: 4.1.1
>
>         Attachments: ForBean.java.tapestry-1177.patch
>
>
> Create a component which doesn't implement ITemplateComponent. In the component specification, declare a For component, but don't bind its optional "element" parameter. Call the For component's render() method.
> Stacktrace is:
> java.lang.NullPointerException
> Stack Trace:
>     * org.apache.tapestry.markup.MarkupWriterImpl.end(MarkupWriterImpl.java:261)
>     * org.apache.tapestry.components.ForBean.renderComponent(ForBean.java:183) 
>     * ...
> The problem is caused by line 140 of ForBean.java:
> String element = HiveMind.isNonBlank(getElement()) ? getElement() : getTemplateTagName();
> Because no element binding was specified, and there's no template, this returns null. The markup writer pushes the null value when begin(null) is called, then barfs when it is popped in end().
> Fix is to not call loopWriter.begin()/end() when element is null.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Resolved: (TAPESTRY-1177) ForBean can cause NullPointerException when rendered without a template

Posted by "Jesse Kuhnert (JIRA)" <ta...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/TAPESTRY-1177?page=all ]

Jesse Kuhnert resolved TAPESTRY-1177.
-------------------------------------

    Resolution: Fixed

Resolved issue by changing line of logic that sets the local "render" boolean to just check if element is null. Thanks for the patch!

> ForBean can cause NullPointerException when rendered without a template
> -----------------------------------------------------------------------
>
>                 Key: TAPESTRY-1177
>                 URL: http://issues.apache.org/jira/browse/TAPESTRY-1177
>             Project: Tapestry
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: 4.1.1
>            Reporter: Phil McCarthy
>         Assigned To: Jesse Kuhnert
>            Priority: Minor
>             Fix For: 4.1.1
>
>         Attachments: ForBean.java.tapestry-1177.patch
>
>
> Create a component which doesn't implement ITemplateComponent. In the component specification, declare a For component, but don't bind its optional "element" parameter. Call the For component's render() method.
> Stacktrace is:
> java.lang.NullPointerException
> Stack Trace:
>     * org.apache.tapestry.markup.MarkupWriterImpl.end(MarkupWriterImpl.java:261)
>     * org.apache.tapestry.components.ForBean.renderComponent(ForBean.java:183) 
>     * ...
> The problem is caused by line 140 of ForBean.java:
> String element = HiveMind.isNonBlank(getElement()) ? getElement() : getTemplateTagName();
> Because no element binding was specified, and there's no template, this returns null. The markup writer pushes the null value when begin(null) is called, then barfs when it is popped in end().
> Fix is to not call loopWriter.begin()/end() when element is null.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org