-
Notifications
You must be signed in to change notification settings - Fork 38.9k
Validate afterThrowing method signature in ThrowsAdviceInterceptor
#1896
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validate afterThrowing method signature in ThrowsAdviceInterceptor
#1896
Conversation
|
I've opened SPR-17088 for the |
|
ok, I will continue to find such case to improve framework and try to find a wider-spread solution, thank you for your encouragement! |
|
It's well spotted indeed, thanks for raising it! As for a wider-spread solution, this is in particular about a common exception type that we would raise in case of an unexpected method signature for a reflectively invoked callback in other parts of the framework. I'm not keen on introducing an exception type just for AOP throws advices there. |
|
I got it. Just now, i found there is an |
|
|
|
ok, i am doing it! |
Includes related polishing in the advice interceptor implementations. Issue: SPR-17088
|
@jhoeller this pr need add more commit? |
afterThrowing method signature in ThrowsAdviceInterceptor
I found
MethodAfterAdviceInterceptorimplementsAfterAdvice, so i thinkMethodBeforeAdviceInterceptoralso should implementsBeforeAdviceto indicate that is a BeforeAdvice.Recently when i search spring source code, i found when
ThrowsAdviceInterceptoris constructed, it just found methods which name isafterThrowingand last param is ThrowableSubclass; but sometimes developer may be disorder the 4 param due to careless(eg:afterThrowing( Object[] args, Method method, Object target, ServletException ex)
), now the error only can be found when exception occur, i think framework should be reminder developer in time, when
ThrowsAdviceInterceptoris constructed, if we find he/she write error, we should tell he/she that error occurs as soon as possible.