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

Reply via email to