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 2008/12/09 10:12:36 UTC

[jira] Created: (TILES-339) JSP tags do not reset attributes when reused

JSP  tags do not reset attributes when reused
---------------------------------------------

                 Key: TILES-339
                 URL: https://issues.apache.org/struts/browse/TILES-339
             Project: Tiles
          Issue Type: Bug
          Components: tiles-jsp (jsp support)
    Affects Versions: 2.1.0, 2.0.6
            Reporter: Antonio Petrelli
            Priority: Blocker


It is simply a misinterpretation of the Tag.release method:
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/Tag.html#release()
Attribute reset must be done in the "doEndTag"!

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


[jira] Updated: (TILES-339) JSP tags do not reset attributes when reused

Posted by "Zach Bailey (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/TILES-339?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Zach Bailey updated TILES-339:
------------------------------

    Attachment: tiles-2.1-reset.patch

Here's my first attempt at a patch which incorporates the changes I outlined above.

It is against the 2.1.0 release tag in subversion.

Let me know if I missed/broke anything, or if this needs to be reworked.

> JSP  tags do not reset attributes when reused
> ---------------------------------------------
>
>                 Key: TILES-339
>                 URL: https://issues.apache.org/struts/browse/TILES-339
>             Project: Tiles
>          Issue Type: Bug
>          Components: tiles-jsp (jsp support)
>    Affects Versions: 2.0.6, 2.1.0
>            Reporter: Antonio Petrelli
>            Priority: Blocker
>         Attachments: tiles-2.1-reset.patch
>
>
> It is simply a misinterpretation of the Tag.release method:
> http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/Tag.html#release()
> Attribute reset must be done in the "doEndTag"!

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


[jira] Updated: (TILES-339) JSP tags do not reset attributes when reused

Posted by "Zach Bailey (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/TILES-339?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Zach Bailey updated TILES-339:
------------------------------

    Attachment: TilesTag.java

TilesTag.java which the patch missed

> JSP  tags do not reset attributes when reused
> ---------------------------------------------
>
>                 Key: TILES-339
>                 URL: https://issues.apache.org/struts/browse/TILES-339
>             Project: Tiles
>          Issue Type: Bug
>          Components: tiles-jsp (jsp support)
>    Affects Versions: 2.0.6, 2.1.0
>            Reporter: Antonio Petrelli
>            Priority: Blocker
>         Attachments: tiles-2.1-reset.patch, tiles-jsp-tags-reset.patch, TilesTag.java
>
>
> It is simply a misinterpretation of the Tag.release method:
> http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/Tag.html#release()
> Attribute reset must be done in the "doEndTag"!

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


[jira] Issue Comment Edited: (TILES-339) JSP tags do not reset attributes when reused

Posted by "Zach Bailey (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/TILES-339?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45276#action_45276 ] 

znbailey edited comment on TILES-339 at 12/16/08 8:01 AM:
-------------------------------------------------------------

I am thinking of the following modifications:

1.) Add an abstract TilesTag and TilesBodyTag which extend TagSupport and BodyTagSupport and both implement TryCatchFinally.
2.) Existing tag classes which extend TagSupport will now extend TilesTag. Existing tag classes which extend BodyTagSupport will extend TilesBodyTag.
3.) Both TilesTag and TilesBodyTag will implement doCatch() in the following manner:

public void doCatch(Throwable throwable) throws Throwable {
        throw throwable;
    }

This is a default (no-op) implementation and will result in no change in handling exceptions thrown from tags.

4.) Both TilesTag and TilesBodyTag will implement doFinally in the following manner:

public void doFinally() {
        //reset any per-invocation resources
        reset();
    }

5.) TilesTag and TilesBodyTag will now define the reset method:

    /**
     * Resets the state of the tag, preparing it for another invocation.
     * Called every invocation after doEndTag via {@link TryCatchFinally#doFinally()}. 
     */
    protected void reset() { }

6.) The release() method will be defined as follows on TilesTag and TilesBodyTag:

/**
     * Release all allocated resources.
     */
    @Override
    public void release() {
        reset();
    }

7.) All logic found in existing release() methods will be moved to the reset() method and the release() methods removed.

Does anyone see any pitfalls or problems with this approach, or see a better way to resolve this issue?

      was (Author: znbailey):
    I am thinking of the following modifications:

# Add an abstract TilesTag and TilesBodyTag which extend TagSupport and BodyTagSupport and both implement TryCatchFinally.
# Existing tag classes which extend TagSupport will now extend TilesTag. Existing tag classes which extend BodyTagSupport will extend TilesBodyTag.
# Both TilesTag and TilesBodyTag will implement doCatch() in the following manner:

public void doCatch(Throwable throwable) throws Throwable {
        throw throwable;
    }

This is a default (no-op) implementation and will result in no change in handling exceptions thrown from tags.

# Both TilesTag and TilesBodyTag will implement doFinally in the following manner:

public void doFinally() {
        //reset any per-invocation resources
        reset();
    }

# TilesTag and TilesBodyTag will now define the reset method:

    /**
     * Resets the state of the tag, preparing it for another invocation.
     * Called every invocation after doEndTag via {@link TryCatchFinally#doFinally()}. 
     */
    protected void reset() { }

# The release() method will be defined as follows on TilesTag and TilesBodyTag:

/**
     * Release all allocated resources.
     */
    @Override
    public void release() {
        reset();
    }

# All logic found in existing release() methods will be moved to the reset() method and the release() methods removed.

Does anyone see any pitfalls or problems with this approach, or see a better way to resolve this issue?
  
> JSP  tags do not reset attributes when reused
> ---------------------------------------------
>
>                 Key: TILES-339
>                 URL: https://issues.apache.org/struts/browse/TILES-339
>             Project: Tiles
>          Issue Type: Bug
>          Components: tiles-jsp (jsp support)
>    Affects Versions: 2.0.6, 2.1.0
>            Reporter: Antonio Petrelli
>            Priority: Blocker
>
> It is simply a misinterpretation of the Tag.release method:
> http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/Tag.html#release()
> Attribute reset must be done in the "doEndTag"!

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


[jira] Resolved: (TILES-339) JSP tags do not reset attributes when reused

Posted by "Antonio Petrelli (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/TILES-339?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Antonio Petrelli resolved TILES-339.
------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.1.1
                   2.0.7

Applied patch posted by Zach Bailey. Merged to TILES_2_0_X branch too.
Thanks a lot Zach, it was very well written!

> JSP  tags do not reset attributes when reused
> ---------------------------------------------
>
>                 Key: TILES-339
>                 URL: https://issues.apache.org/struts/browse/TILES-339
>             Project: Tiles
>          Issue Type: Bug
>          Components: tiles-jsp (jsp support)
>    Affects Versions: 2.0.6, 2.1.0
>            Reporter: Antonio Petrelli
>            Assignee: Antonio Petrelli
>            Priority: Blocker
>             Fix For: 2.0.7, 2.1.1
>
>         Attachments: tiles-2.1-reset.patch, tiles-jsp-tags-reset.patch, TilesBodyTag.java, TilesTag.java
>
>
> It is simply a misinterpretation of the Tag.release method:
> http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/Tag.html#release()
> Attribute reset must be done in the "doEndTag"!

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


[jira] Commented: (TILES-339) JSP tags do not reset attributes when reused

Posted by "Zach Bailey (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/TILES-339?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45295#action_45295 ] 

Zach Bailey commented on TILES-339:
-----------------------------------

Argh, somehow Eclipse missed the two unversioned files (TilesTag and TilesBodyTag) when generating this latest patch. I'll go ahead and attach them individually. These should go in the base taglib package.

> JSP  tags do not reset attributes when reused
> ---------------------------------------------
>
>                 Key: TILES-339
>                 URL: https://issues.apache.org/struts/browse/TILES-339
>             Project: Tiles
>          Issue Type: Bug
>          Components: tiles-jsp (jsp support)
>    Affects Versions: 2.0.6, 2.1.0
>            Reporter: Antonio Petrelli
>            Priority: Blocker
>         Attachments: tiles-2.1-reset.patch, tiles-jsp-tags-reset.patch
>
>
> It is simply a misinterpretation of the Tag.release method:
> http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/Tag.html#release()
> Attribute reset must be done in the "doEndTag"!

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


[jira] Issue Comment Edited: (TILES-339) JSP tags do not reset attributes when reused

Posted by "Zach Bailey (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/TILES-339?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45276#action_45276 ] 

znbailey edited comment on TILES-339 at 12/16/08 8:02 AM:
-------------------------------------------------------------

I am thinking of the following modifications:

1.) Add an abstract TilesTag and TilesBodyTag which extend TagSupport and BodyTagSupport and both implement TryCatchFinally.
2.) Existing tag classes which extend TagSupport will now extend TilesTag. Existing tag classes which extend BodyTagSupport will extend TilesBodyTag.
3.) Both TilesTag and TilesBodyTag will implement doCatch() in the following manner:

public void doCatch(Throwable throwable) throws Throwable {
        throw throwable;
    }

This is a default (no-op) implementation and will result in no change in handling exceptions thrown from tags.

4.) Both TilesTag and TilesBodyTag will implement doFinally in the following manner:

public void doFinally() {
        //reset any per-invocation resources
        reset();
    }

5.) TilesTag and TilesBodyTag will now define the reset method:

    /**
     * Resets the state of the tag, preparing it for another invocation.
     * Called every invocation after doEndTag via {@link TryCatchFinally#doFinally()}. 
     */
    protected void reset() { }

6.) The release() method will be defined as follows on TilesTag and TilesBodyTag:

/**
     * Release all allocated resources.
     */
    @Override
    public void release() {
        super.release();
        reset();
    }

7.) All logic found in existing release() methods will be moved to the reset() method and the release() methods removed.

Does anyone see any pitfalls or problems with this approach, or see a better way to resolve this issue?

      was (Author: znbailey):
    I am thinking of the following modifications:

1.) Add an abstract TilesTag and TilesBodyTag which extend TagSupport and BodyTagSupport and both implement TryCatchFinally.
2.) Existing tag classes which extend TagSupport will now extend TilesTag. Existing tag classes which extend BodyTagSupport will extend TilesBodyTag.
3.) Both TilesTag and TilesBodyTag will implement doCatch() in the following manner:

public void doCatch(Throwable throwable) throws Throwable {
        throw throwable;
    }

This is a default (no-op) implementation and will result in no change in handling exceptions thrown from tags.

4.) Both TilesTag and TilesBodyTag will implement doFinally in the following manner:

public void doFinally() {
        //reset any per-invocation resources
        reset();
    }

5.) TilesTag and TilesBodyTag will now define the reset method:

    /**
     * Resets the state of the tag, preparing it for another invocation.
     * Called every invocation after doEndTag via {@link TryCatchFinally#doFinally()}. 
     */
    protected void reset() { }

6.) The release() method will be defined as follows on TilesTag and TilesBodyTag:

/**
     * Release all allocated resources.
     */
    @Override
    public void release() {
        reset();
    }

7.) All logic found in existing release() methods will be moved to the reset() method and the release() methods removed.

Does anyone see any pitfalls or problems with this approach, or see a better way to resolve this issue?
  
> JSP  tags do not reset attributes when reused
> ---------------------------------------------
>
>                 Key: TILES-339
>                 URL: https://issues.apache.org/struts/browse/TILES-339
>             Project: Tiles
>          Issue Type: Bug
>          Components: tiles-jsp (jsp support)
>    Affects Versions: 2.0.6, 2.1.0
>            Reporter: Antonio Petrelli
>            Priority: Blocker
>
> It is simply a misinterpretation of the Tag.release method:
> http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/Tag.html#release()
> Attribute reset must be done in the "doEndTag"!

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


[jira] Updated: (TILES-339) JSP tags do not reset attributes when reused

Posted by "Zach Bailey (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/TILES-339?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Zach Bailey updated TILES-339:
------------------------------

    Attachment: TilesBodyTag.java

The other file missed by the patch - TilesBodyTag

> JSP  tags do not reset attributes when reused
> ---------------------------------------------
>
>                 Key: TILES-339
>                 URL: https://issues.apache.org/struts/browse/TILES-339
>             Project: Tiles
>          Issue Type: Bug
>          Components: tiles-jsp (jsp support)
>    Affects Versions: 2.0.6, 2.1.0
>            Reporter: Antonio Petrelli
>            Priority: Blocker
>         Attachments: tiles-2.1-reset.patch, tiles-jsp-tags-reset.patch, TilesBodyTag.java, TilesTag.java
>
>
> It is simply a misinterpretation of the Tag.release method:
> http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/Tag.html#release()
> Attribute reset must be done in the "doEndTag"!

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


[jira] Closed: (TILES-339) JSP tags do not reset attributes when reused

Posted by "Antonio Petrelli (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/TILES-339?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Antonio Petrelli closed TILES-339.
----------------------------------


Closed due to the release of Tiles 2.0.7.

> JSP  tags do not reset attributes when reused
> ---------------------------------------------
>
>                 Key: TILES-339
>                 URL: https://issues.apache.org/struts/browse/TILES-339
>             Project: Tiles
>          Issue Type: Bug
>          Components: tiles-jsp (jsp support)
>    Affects Versions: 2.0.6, 2.1.0
>            Reporter: Antonio Petrelli
>            Assignee: Antonio Petrelli
>            Priority: Blocker
>             Fix For: 2.0.7, 2.1.1
>
>         Attachments: tiles-2.1-reset.patch, tiles-jsp-tags-reset.patch, TilesBodyTag.java, TilesTag.java
>
>
> It is simply a misinterpretation of the Tag.release method:
> http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/Tag.html#release()
> Attribute reset must be done in the "doEndTag"!

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


[jira] Commented: (TILES-339) JSP tags do not reset attributes when reused

Posted by "Antonio Petrelli (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/TILES-339?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45289#action_45289 ] 

Antonio Petrelli commented on TILES-339:
----------------------------------------

Can you create a patch against the trunk please?

> JSP  tags do not reset attributes when reused
> ---------------------------------------------
>
>                 Key: TILES-339
>                 URL: https://issues.apache.org/struts/browse/TILES-339
>             Project: Tiles
>          Issue Type: Bug
>          Components: tiles-jsp (jsp support)
>    Affects Versions: 2.0.6, 2.1.0
>            Reporter: Antonio Petrelli
>            Priority: Blocker
>         Attachments: tiles-2.1-reset.patch
>
>
> It is simply a misinterpretation of the Tag.release method:
> http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/Tag.html#release()
> Attribute reset must be done in the "doEndTag"!

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


[jira] Commented: (TILES-339) JSP tags do not reset attributes when reused

Posted by "Antonio Petrelli (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/TILES-339?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45280#action_45280 ] 

Antonio Petrelli commented on TILES-339:
----------------------------------------

+1 to everything, Zach.
I thought that TryCatchFinally interface was too much, but in fact it is the best approach to ensure that the reset method is always called.

> JSP  tags do not reset attributes when reused
> ---------------------------------------------
>
>                 Key: TILES-339
>                 URL: https://issues.apache.org/struts/browse/TILES-339
>             Project: Tiles
>          Issue Type: Bug
>          Components: tiles-jsp (jsp support)
>    Affects Versions: 2.0.6, 2.1.0
>            Reporter: Antonio Petrelli
>            Priority: Blocker
>
> It is simply a misinterpretation of the Tag.release method:
> http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/Tag.html#release()
> Attribute reset must be done in the "doEndTag"!

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


[jira] Updated: (TILES-339) JSP tags do not reset attributes when reused

Posted by "Zach Bailey (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/TILES-339?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Zach Bailey updated TILES-339:
------------------------------

    Attachment: tiles-jsp-tags-reset.patch

Yep, here is that same changeset patched against trunk.

filename: tiles-jsp-tags-reset.patch

> JSP  tags do not reset attributes when reused
> ---------------------------------------------
>
>                 Key: TILES-339
>                 URL: https://issues.apache.org/struts/browse/TILES-339
>             Project: Tiles
>          Issue Type: Bug
>          Components: tiles-jsp (jsp support)
>    Affects Versions: 2.0.6, 2.1.0
>            Reporter: Antonio Petrelli
>            Priority: Blocker
>         Attachments: tiles-2.1-reset.patch, tiles-jsp-tags-reset.patch
>
>
> It is simply a misinterpretation of the Tag.release method:
> http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/Tag.html#release()
> Attribute reset must be done in the "doEndTag"!

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


[jira] Commented: (TILES-339) JSP tags do not reset attributes when reused

Posted by "Zach Bailey (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/TILES-339?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45276#action_45276 ] 

Zach Bailey commented on TILES-339:
-----------------------------------

I am thinking of the following modifications:

# Add an abstract TilesTag and TilesBodyTag which extend TagSupport and BodyTagSupport and both implement TryCatchFinally.
# Existing tag classes which extend TagSupport will now extend TilesTag. Existing tag classes which extend BodyTagSupport will extend TilesBodyTag.
# Both TilesTag and TilesBodyTag will implement doCatch() in the following manner:

public void doCatch(Throwable throwable) throws Throwable {
        throw throwable;
    }

This is a default (no-op) implementation and will result in no change in handling exceptions thrown from tags.

# Both TilesTag and TilesBodyTag will implement doFinally in the following manner:

public void doFinally() {
        //reset any per-invocation resources
        reset();
    }

# TilesTag and TilesBodyTag will now define the reset method:

    /**
     * Resets the state of the tag, preparing it for another invocation.
     * Called every invocation after doEndTag via {@link TryCatchFinally#doFinally()}. 
     */
    protected void reset() { }

# The release() method will be defined as follows on TilesTag and TilesBodyTag:

/**
     * Release all allocated resources.
     */
    @Override
    public void release() {
        reset();
    }

# All logic found in existing release() methods will be moved to the reset() method and the release() methods removed.

Does anyone see any pitfalls or problems with this approach, or see a better way to resolve this issue?

> JSP  tags do not reset attributes when reused
> ---------------------------------------------
>
>                 Key: TILES-339
>                 URL: https://issues.apache.org/struts/browse/TILES-339
>             Project: Tiles
>          Issue Type: Bug
>          Components: tiles-jsp (jsp support)
>    Affects Versions: 2.0.6, 2.1.0
>            Reporter: Antonio Petrelli
>            Priority: Blocker
>
> It is simply a misinterpretation of the Tag.release method:
> http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/Tag.html#release()
> Attribute reset must be done in the "doEndTag"!

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


[jira] Updated: (TILES-339) JSP tags do not reset attributes when reused

Posted by "Antonio Petrelli (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/TILES-339?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Antonio Petrelli updated TILES-339:
-----------------------------------

    Assignee: Antonio Petrelli

> JSP  tags do not reset attributes when reused
> ---------------------------------------------
>
>                 Key: TILES-339
>                 URL: https://issues.apache.org/struts/browse/TILES-339
>             Project: Tiles
>          Issue Type: Bug
>          Components: tiles-jsp (jsp support)
>    Affects Versions: 2.0.6, 2.1.0
>            Reporter: Antonio Petrelli
>            Assignee: Antonio Petrelli
>            Priority: Blocker
>         Attachments: tiles-2.1-reset.patch, tiles-jsp-tags-reset.patch, TilesBodyTag.java, TilesTag.java
>
>
> It is simply a misinterpretation of the Tag.release method:
> http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/Tag.html#release()
> Attribute reset must be done in the "doEndTag"!

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