Hey I just wanted to thank you both (Josh and Thiago) before I forget;
this helped solve a tough production bug that was affecting a lot of
people.

I wanted to write a doc snippet to go in the Component Classes page in
the guide under "Transient Instance Variables" in a warning
box/pullout after the first paragraph, rewording and summing up what
you both have said:

"""
Never initialize an instance field to a mutable object at the point of
declaration.  If this is done, the instance created from that
initializer becomes the default value for that field and is reused
inside the component on every request.  This could cause state to
inadvertently be shared between different sessions in an application.
"""

I don't know who to send it to or if there is a documentation manager,
but the above is public domain if (s)he wants it.

Thanks,
Les Baker

On Thu, Jan 5, 2012 at 5:53 AM, Thiago H. de Paula Figueiredo
<thiag...@gmail.com> wrote:
> On Thu, 05 Jan 2012 03:35:53 -0200, robert baker <les.baker1...@gmail.com>
> wrote:
>
>> Hi all,
>
>
> Hi!
>
>
>> When a page/component is transformed (in version 5.2.6) and there is a
>> field like the following:
>>
>> private List<TheType> aList = new ArrayList<TheType>();
>
>
> You should never, never, never, ever initialize a component, page or mixin
> field in its declaration unless it's an atomic value (primitive types,
> String, wrappers, immutable data).
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and
> instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to