Hi Ilya,

Thank you for the hint. You're right, this could be the problem. I moved the 
initialization to onPrepare() and will do some testing with expired sessions.

Best,
Thilo



________________________________________
From: Ilya Obshadko <ilya.obsha...@gmail.com>
Sent: Monday, May 26, 2014 09:48
To: Tapestry users
Subject: Re: [T5.4] Component Rendering / Form Events

That might occur when session expires between page rendering and form
submission. @SetupRender phase isn't being called during form submission,
only afterwards. So you'd better use onPrepareForSubmit phase for
submission-safe initialization.


On Mon, May 26, 2014 at 11:41 AM, Thilo Tanner <thilo.tan...@reprisk.com>wrote:

> Hi all,
>
> I'm a bit puzzled how the component rendering and form events play
> together. I have a component class with the following code:
>
> @Persist
> private Set<Long> ids;
>
> @SetupRender
> public void setup() {
>     if(ids == null) {
>         ids = new HashSet<>();
>     }
> }
>
> public void onSuccess() {
>     doSomethingWithIds(); // NPE
> }
>
> The problem: within onSuccess, the "ids" set is null sometimes, which
> causes a NPE. Interestingly, I cannot reproduce it myself, the problem
> appears only in the production environment. I know, that it is probably
> better to initialize "ids" within onPrepare(), but setupRender should at
> least be called once, when the component is rendered for the first time
> anyway. The reason is, that there are AJAX events updating the "ids" hash.
> Puzzling is, that during the event processing from the AJAX calls "ids" is
> never null, everything works as expected.
>
> Is this a bug? I wonder how onSuccess is being called, without a
> setupRender phase.
>
> Thanks for all the hints and best,
> Thilo
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


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

Reply via email to