@ -618,28 +618,35 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
@@ -618,28 +618,35 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
* @return the invocation result
* @throws Throwable in case of invocation failure
* /
protected Object invokeAdviceMethod (
@Nullable JoinPointMatch jpMatch , @Nullable Object returnValue , @Nullable Throwable ex )
throws Throwable {
protected @Nullable Object invokeAdviceMethod ( @Nullable JoinPointMatch jpMatch ,
@Nullable Object returnValue , @Nullable Throwable ex ) throws Throwable {
return invokeAdviceMethodWithGivenArgs ( argBinding ( getJoinPoint ( ) , jpMatch , returnValue , ex ) ) ;
}
// As above, but in this case we are given the join point.
protected Object invokeAdviceMethod ( JoinPoint jp , @Nullable JoinPointMatch jpMatch ,
protected @Nullable Object invokeAdviceMethod ( JoinPoint jp , @Nullable JoinPointMatch jpMatch ,
@Nullable Object returnValue , @Nullable Throwable t ) throws Throwable {
return invokeAdviceMethodWithGivenArgs ( argBinding ( jp , jpMatch , returnValue , t ) ) ;
}
protected Object invokeAdviceMethodWithGivenArgs ( Object [ ] args ) throws Throwable {
protected @Nullable Object invokeAdviceMethodWithGivenArgs ( Object [ ] args ) throws Throwable {
Object [ ] actualArgs = args ;
if ( this . aspectJAdviceMethod . getParameterCount ( ) = = 0 ) {
actualArgs = null ;
}
Object aspectInstance = this . aspectInstanceFactory . getAspectInstance ( ) ;
if ( aspectInstance . equals ( null ) ) {
// Possibly a NullBean -> simply proceed if necessary.
if ( getJoinPoint ( ) instanceof ProceedingJoinPoint pjp ) {
return pjp . proceed ( ) ;
}
return null ;
}
try {
ReflectionUtils . makeAccessible ( this . aspectJAdviceMethod ) ;
return this . aspectJAdviceMethod . invoke ( this . aspectInstanceFactory . getAspectInstance ( ) , actualArgs ) ;
return this . aspectJAdviceMethod . invoke ( aspectInstance , actualArgs ) ;
}
catch ( IllegalArgumentException ex ) {
throw new AopInvocationException ( "Mismatch on arguments to advice method [" +