You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@tiles.apache.org by "Antonio Petrelli (JIRA)" <ji...@apache.org> on 2011/01/21 11:00:43 UTC

[jira] Commented: (TILES-519) tiles:getAsString is not cleaning tiles context when attribute is not present and ignore=true

    [ https://issues.apache.org/jira/browse/TILES-519?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12984654#action_12984654 ] 

Antonio Petrelli commented on TILES-519:
----------------------------------------

Can you attach a patch, as a diff, for this? This way your name will be put in our SVN log for your contributions.

Thanks.

> tiles:getAsString is not cleaning tiles context when attribute is not present and ignore=true
> ---------------------------------------------------------------------------------------------
>
>                 Key: TILES-519
>                 URL: https://issues.apache.org/jira/browse/TILES-519
>             Project: Tiles
>          Issue Type: Bug
>          Components: tiles-template
>    Affects Versions: 2.2.2
>            Reporter: Vitaly Polonetsky
>
> After putting this line in the template:
> <tiles:getAsString name="subtitle" ignore="true"/>
> <tiles:insertAttribute name="body" />
> And if "subtitle" attribute is not defined. The page will fail on rendering the "body" attribute, because getAsString failed to cleanup it's tiles context (endContext() is not executed).
> SOLUTION:
> The problem is in GetAsStringModel class, in the last method - renderAttribute():
> The first three lines that check for null attribute and ignore flag should be inside the try caluse:
> try {
>         if (attribute == null && ignore) {
>             return;
>         }
>         writer.write(...
> This way the finally clause will be executed even in attribute is null and should be ignored. The finally clause is ending the tiles context.
> This is the same as the code inside: InsertAttributeModel.renderAttribute()

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.