2 Replies Latest reply on Apr 29, 2009 5:03 PM by cpopetz

    WicketHandler messes up reentrant counter in class hierarchies??

    bennobuesch

      after a desperate debug session i finally found out why seam disinjected all components of my class after calling a method in its super class:


      Scenario:



      public class TestParentPage extends WebPage {
           @In private TestComponent1 testComponent1;
           public TestParentPage(){
                add( new Label("parentLabel", testComponent1.getText()));
           }
           public String getAnotherText(){return "anotherText";}
      



      public class TestPage extends TestParentPage {
           @In private TestComponent2 testComponent2;     
           public TestPage(){
      (1)          String anotherText = getAnotherText();
      (2)          add( new Label("childLabel", anotherText + " " + testComponent2.getText()));
           }
      



      before executing line (1) TestPage has correct members, testComponent 1 and 2 have a value;
      then the super class's method getAnotherText() is called, and the interceptor injects and - after the method call - disinjects the fields, so line (2) will throw a NPE cause testComponent2 is null;


      why this? when wicket instruments the Page (JavassistInstrumentor) it adds a wicketHandler-field to every class; this wicketHandler is responsible for managing the reentrant-state.
      but because EVERY class gets this handler, TestPage has two wicketHandler-fields named handler, the child class's field hides the parent's class field. so in a call to the parent class the handler cannot see the reentrant-state of the handler of the child.


      i had this error with 2.1.1 and 2.1.2CR1.


      i'm unclear on how to fix this... in JavassistInstrumentor, in WicketHandler, ... any hint?


      cheers uwe!