Skip to content

Commit 67ea314

Browse files
committed
Incorrect parameter count when enabling AspectJ transaction
1 parent 673e2b0 commit 67ea314

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

Diff for: spring-aop/src/main/java/org/springframework/aop/aspectj/AbstractAspectJAdvice.java

+10-8
Original file line numberDiff line numberDiff line change
@@ -272,14 +272,16 @@ public void setArgumentNamesFromStringArray(@Nullable String... argumentNames) {
272272
}
273273
if (this.aspectJAdviceMethod.getParameterCount() == this.argumentNames.length + 1) {
274274
// May need to add implicit join point arg name...
275-
Class<?> firstArgType = this.aspectJAdviceMethod.getParameterTypes()[0];
276-
if (firstArgType == JoinPoint.class ||
277-
firstArgType == ProceedingJoinPoint.class ||
278-
firstArgType == JoinPoint.StaticPart.class) {
279-
@Nullable String[] oldNames = this.argumentNames;
280-
this.argumentNames = new String[oldNames.length + 1];
281-
this.argumentNames[0] = "THIS_JOIN_POINT";
282-
System.arraycopy(oldNames, 0, this.argumentNames, 1, oldNames.length);
275+
for (int i = 0; i < this.aspectJAdviceMethod.getParameterCount(); i++) {
276+
Class<?> argType = this.aspectJAdviceMethod.getParameterTypes()[i];
277+
if (argType == JoinPoint.class ||
278+
argType == ProceedingJoinPoint.class ||
279+
argType == JoinPoint.StaticPart.class) {
280+
@Nullable String[] oldNames = this.argumentNames;
281+
this.argumentNames = new String[oldNames.length + 1];
282+
this.argumentNames[0] = "THIS_JOIN_POINT";
283+
System.arraycopy(oldNames, 0, this.argumentNames, 1, oldNames.length);
284+
}
283285
}
284286
}
285287
}

0 commit comments

Comments
 (0)