Skip to content

Commit f9bc419

Browse files
committed
GH-1675: Resolve Sonar Issue (Method Complexity)
1 parent aa507b3 commit f9bc419

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

spring-kafka/src/main/java/org/springframework/kafka/listener/adapter/DelegatingInvocableHandler.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,15 @@ protected boolean matchHandlerMethod(Class<? extends Object> payloadClass, Invoc
330330
}
331331
}
332332

333+
MethodParameter foundCandidate = findCandidate(payloadClass, method, parameterAnnotations);
334+
if (foundCandidate != null && this.validator != null) {
335+
this.payloadMethodParameters.put(handler, foundCandidate);
336+
}
337+
return foundCandidate != null;
338+
}
339+
340+
private MethodParameter findCandidate(Class<? extends Object> payloadClass, Method method,
341+
Annotation[][] parameterAnnotations) {
333342
MethodParameter foundCandidate = null;
334343
for (int i = 0; i < parameterAnnotations.length; i++) {
335344
MethodParameter methodParameter = new MethodParameter(method, i);
@@ -342,10 +351,7 @@ protected boolean matchHandlerMethod(Class<? extends Object> payloadClass, Invoc
342351
foundCandidate = methodParameter;
343352
}
344353
}
345-
if (foundCandidate != null && this.validator != null) {
346-
this.payloadMethodParameters.put(handler, foundCandidate);
347-
}
348-
return foundCandidate != null;
354+
return foundCandidate;
349355
}
350356

351357
/**

0 commit comments

Comments
 (0)