JSP tag pooling is in general a nightmare that should be ended :(  I  
think it took me 2-3 years to really understand what's going on, and  
it's so poorly designed that I keep forgetting and assuming it works  
some sensible way ;)  Unfortunately there's no way to turn off  
pooling for a taglib or otherwise control the behaviour so we're  
stuck with it.

-t

On Feb 27, 2008, at 9:31 AM, Aaron Porter wrote:

> Ok, I was unaware of that. I'll remove the release() call from
> doEndTag() and just clear the attributes instead. That will make the
> change I just checked in unnecessary so I'll change it back.
>
> Aaron
>
> Tim Fennell wrote:
>> I haven't been following the checkins closely on this but I want to
>> make sure of something.  Although it's horribly confusing the release
>> () method should only be called by the JSP container.  The contract
>> is that it will be called when a tag is end-of-lifed and about to be
>> discarded, NOT between usages of the tag.  It's retarded, but that's
>> the way it is and we shouldn't be overloading the meaning of it.
>>
>> The general pattern that we've followed with tags is that in the
>> doEndTag() method any state that is not set directly by the container
>> should be cleaned up and reset so that /if/ the tag gets pooled then
>> things will work safely.
>>
>> -t
>>
>> On Feb 27, 2008, at 9:21 AM, Aaron Porter wrote:
>>
>>
>>> Iwao,
>>> It is fixed now. You were correct, the InputOptionsCollectionTag was
>>> reusing an InputOptionTag and expecting attributes to remain the  
>>> same
>>> between uses which was changed with rev 865.
>>>
>>> Aaron
>>>
>>> Iwao AVE! wrote:
>>>
>>>> Hi,
>>>>
>>>> I think this check-in causes NPE when a JSP contains
>>>> <options-enumeration/> tag.
>>>> Could somebody confirm it?
>>>>
>>>> - Stack Trace
>>>> Caused by: java.lang.NullPointerException
>>>>    at
>>>> net.sourceforge.stripes.tag.StripesTagSupport.getTagStack
>>>> (StripesTagSupport.java:163)
>>>>    at
>>>> net.sourceforge.stripes.tag.InputTagSupport.doStartTag
>>>> (InputTagSupport.java:391)
>>>>    at
>>>> net.sourceforge.stripes.tag.InputOptionsCollectionTag.doEndTag
>>>> (InputOptionsCollectionTag.java:320)
>>>> ...
>>>>
>>>> - Tested on:
>>>> Mac OS X 10.4.11 / Java 1.5.0_13 / Jetty 6.1.5, Tomcat 5.5.26
>>>>
>>>> // Iwao AVE!
>>>>
>>>> [EMAIL PROTECTED] wrote on 08.2.27 10:22 AM:
>>>>
>>>>
>>>>> Revision: 865
>>>>>           http://stripes.svn.sourceforge.net/stripes/?
>>>>> rev=865&view=rev
>>>>> Author:   mongus
>>>>> Date:     2008-02-26 17:22:35 -0800 (Tue, 26 Feb 2008)
>>>>>
>>>>> Log Message:
>>>>> -----------
>>>>> Tag reuse by a servlet container within the same form was causing
>>>>> attributes set in one tag to show up in following tags. The code
>>>>> now calls release after the tag is rendered to clear it out.
>>>>>
>>>>> Modified Paths:
>>>>> --------------
>>>>>     trunk/stripes/src/net/sourceforge/stripes/tag/
>>>>> FieldMetadataTag.java
>>>>>     trunk/stripes/src/net/sourceforge/stripes/tag/
>>>>> InputTagSupport.java
>>>>>
>>>>> Modified: trunk/stripes/src/net/sourceforge/stripes/tag/
>>>>> FieldMetadataTag.java
>>>>> ================================================================== 
>>>>> =
>>>>> --- trunk/stripes/src/net/sourceforge/stripes/tag/
>>>>> FieldMetadataTag.java     2008-02-26 01:06:05 UTC (rev 864)
>>>>> +++ trunk/stripes/src/net/sourceforge/stripes/tag/
>>>>> FieldMetadataTag.java     2008-02-27 01:22:35 UTC (rev 865)
>>>>> @@ -397,4 +397,15 @@
>>>>>              return formId;
>>>>>          }
>>>>>      }
>>>>> +
>>>>> +    /** Release method to clean up the state of the tag to
>>>>> prepare it for re-use. */
>>>>> +    @Override
>>>>> +    public void release() {
>>>>> +        // Because the type attribute is set in the  
>>>>> constructor and
>>>>> +        // the attributes are cleared we need to save the type  
>>>>> and
>>>>> +        // replace it after calling super.release().
>>>>> +        String type = getAttributes().get("type");
>>>>> +        super.release();
>>>>> +        getAttributes().put("type", type);
>>>>> +    }
>>>>>  }
>>>>>
>>>>> Modified: trunk/stripes/src/net/sourceforge/stripes/tag/
>>>>> InputTagSupport.java
>>>>> ================================================================== 
>>>>> =
>>>>> --- trunk/stripes/src/net/sourceforge/stripes/tag/
>>>>> InputTagSupport.java      2008-02-26 01:06:05 UTC (rev 864)
>>>>> +++ trunk/stripes/src/net/sourceforge/stripes/tag/
>>>>> InputTagSupport.java      2008-02-27 01:22:35 UTC (rev 865)
>>>>> @@ -438,13 +438,26 @@
>>>>>              return result;
>>>>>          }
>>>>>          finally {
>>>>> -            this.errorRenderer = null;
>>>>> -            this.fieldErrors = null;
>>>>> -            this.fieldErrorsLoaded = false;
>>>>> -            this.focus = false;
>>>>> +            this.release();
>>>>>          }
>>>>>      }
>>>>> +
>>>>> +    /** Release method to clean up the state of the tag ready
>>>>> for re-use. */
>>>>> +    @Override
>>>>> +    public void release() {
>>>>> +        this.errorRenderer = null;
>>>>> +        this.fieldErrors = null;
>>>>> +        this.fieldErrorsLoaded = false;
>>>>> +        this.focus = false;
>>>>>
>>>>> +        // Because the type attribute is set in the  
>>>>> constructor and
>>>>> +        // the attributes are cleared we need to save the type  
>>>>> and
>>>>> +        // replace it after calling super.release().
>>>>> +        String type = getAttributes().get("type");
>>>>> +        super.release();
>>>>> +        getAttributes().put("type", type);
>>>>> +    }
>>>>> +
>>>>>      /** Rethrows the passed in throwable in all cases. */
>>>>>      public void doCatch(Throwable throwable) throws Throwable
>>>>> { throw throwable; }
>>>>>
>>>>>
>>>>>
>>>>> This was sent by the SourceForge.net collaborative development
>>>>> platform, the world's largest Open Source development site.
>>>>>
>>>>> ------------------------------------------------------------------ 
>>>>> --
>>>>> -----
>>>>> This SF.net email is sponsored by: Microsoft
>>>>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>>>>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>>>>> _______________________________________________
>>>>> Stripes-development mailing list
>>>>> [email protected]
>>>>> https://lists.sourceforge.net/lists/listinfo/stripes-development
>>>>>
>>>>>
>>>> ------------------------------------------------------------------- 
>>>> --
>>>> ----
>>>> This SF.net email is sponsored by: Microsoft
>>>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>>>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>>>> _______________________________________________
>>>> Stripes-development mailing list
>>>> [email protected]
>>>> https://lists.sourceforge.net/lists/listinfo/stripes-development
>>>>
>>>>
>>>>
>>>>
>>> -------------------------------------------------------------------- 
>>> --
>>> ---
>>> This SF.net email is sponsored by: Microsoft
>>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>>> _______________________________________________
>>> Stripes-development mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/stripes-development
>>>
>>
>>
>> --------------------------------------------------------------------- 
>> ----
>> This SF.net email is sponsored by: Microsoft
>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>> _______________________________________________
>> Stripes-development mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/stripes-development
>>
>>
>>
>
>
> ---------------------------------------------------------------------- 
> ---
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Stripes-development mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/stripes-development


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to