Please read the MethodAdviceReceiver JavaDoc for instructions.

Also, why did it not occur to you to do that yourself?

On Wed, Aug 1, 2012 at 12:27 PM, George Christman
<[email protected]> wrote:
> Hello, a while ago I built this production exception handler. I just noticed
> that some of the methods are now marked as deprecated. I was wondering if
> someone could tell me what I'm suppose to do to repair the deprecated
> methods.
>
>
>     @Match("RequestExceptionHandler")       // service to advise
>     @Order("after:requestExceptionHandler") // advice id from
> tapestry-security SecurityModule
>     public static void adviseProductionExceptionHandler(
>             MethodAdviceReceiver receiver,
>             final Logger logger,
>             final @Symbol(SymbolConstants.PRODUCTION_MODE) boolean
> productionMode,
>             final ProductionExceptionHandler handler) {
>
>         Method handleMethod;
>
>         try {
>             Class<?> serviceInterface = receiver.getInterface();
>             handleMethod =
> serviceInterface.getMethod(EXCEPTION_HANDLE_METHOD_NAME, Throwable.class);
>         } catch (Exception e) {
>             throw new RuntimeException("Can't find method
> RequestExceptionHandler." + EXCEPTION_HANDLE_METHOD_NAME + ". Changed API?",
> e);
>         }
>
>         MethodAdvice advice = new MethodAdvice() {
>             public void advise(Invocation invocation) {
>                 if (productionMode) {
>                     Throwable exception = (Throwable)
> invocation.getParameter(0);
>                     try {
>                         handler.handle(exception);
>                     } catch (IOException e) {
>                         logger.error("Error in ProductionExceptionHandler",
> e);
>                         invocation.proceed();
>                     }
>                 } else {
>                     invocation.proceed();
>                 }
>             }
>
>         };
>
>         receiver.adviseMethod(handleMethod, advice);
>     }
>
>
>
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/MethodAdvice-Deprecated-tp5714955.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to