1 Reply Latest reply on Feb 4, 2009 5:18 PM by Clint Popetz

    Wicket component disinject on provate methods

    Nigel Collis Newbie
      Hi,

      I'm using Seam 2.1.1.GA and when I call a private method in a wicket page from a public method, all the annotated attributes are being bijected. This means they ar all disinjected when the private method returns and any further referencees to those attributes throw nullpointer exceptions.

      I think the problem is in JavassistInstrumentor line 62, all methods other than static and abstract are instrumented.

      Example code in a wicket page that fails:

        @In(create=true)
        private String test

        private void aPrivateMethod() {
              .. 
        }

      ... (in Wicket Form component)

        public void onSubmit() {
          aPrivateMethod()
          if (test.equals("Test")) {
              ... something
          }
        }

      ...

      You'll get a nullpointer on the test.equals() call as disinject is called during the return of aPrivateMethod() which is instrumented.

      Is this a bug or intended behaviour, if so why?

      Regards

      Nigel Collis
        • 1. Re: Wicket component disinject on provate methods
          Clint Popetz Apprentice

          You'll need to put more complete source up, or an example project, because I have code like yours above in several seam/wicket pages, and don't experience this bug.  The interceptor which does bijection keeps track of re-entrancy, so that it only injects on the first call to a wicket page, and only dis-injects on the return of the first call.  Nested calls should be no-ops with regard to bijection of wicket, just like in normal seam components.


          I'm not saying there isn't a bug; I just need more to find it :)