1 Reply Latest reply on Mar 20, 2009 12:41 PM by Clint Popetz

    wicket.ioc.JavassistInstrumentor violates IPageFactory's exception contract

    thonis meta Newbie

      after i tried to use wicket's AbortException/AuthorizationException/etc. with seam, i recognized that they dont work any more.


      if i understand it correctly, seam's instrumentation-code always wraps exceptions within a new RuntimeException, even when the thrown exception is already a RuntimeException (e.g. AbortException). then wicket does not recognize the AbortException as it's wrapped another time (...if( e.getTargetException() instanceof AbortException...)


      my - maybe naive - approach would be to modify the code in JavassistInstrumentor.java (see below) to create the new wrapper-RuntimeException only if the exception is not already a RuntimeException and return the exception without wrapping if it is already a RTE.


      if that does not break sth else i would open a jira issue for this and provide a patch.
      so pls give me feedback if you agree on this.


      cheers, thonis!



      relevant code from JavassistInstrumentor.java:
      
      wrapInExceptionHandler(String src):
            return "try {" + src + "} catch (Exception e) { throw new RuntimeException(this.handler == null ? e : this.handler.handleException(this, method, e)); }";
      
      instrumentClass(String className):
            constructor.addCatch("{" + constructorObject + "throw new RuntimeException(handler.handleException(this, constructor, e));}", exception, "e");
      


        • 1. Re: wicket.ioc.JavassistInstrumentor violates IPageFactory's exception contract
          Clint Popetz Apprentice

          thonis meta wrote on Mar 20, 2009 10:06:


          my - maybe naive - approach would be to modify the code in JavassistInstrumentor.java (see below) to create the new wrapper-RuntimeException only if the exception is not already a RuntimeException and return the exception without wrapping if it is already a RTE.

          if that does not break sth else i would open a jira issue for this and provide a patch.
          so pls give me feedback if you agree on this.




          Good catch.  I think your suggestion is the correct one; please open a jira with your patch.


          Thanks!
          -Clint