Fix ParsePathUtil#parameterEquals method ArrayIndexOutOfBoundsException error and some typo (#5216)
This commit is contained in:
parent
4f011585ee
commit
118e334e7c
|
|
@ -29,7 +29,7 @@ import java.util.function.Function;
|
|||
*/
|
||||
public class ParsePathUtil {
|
||||
|
||||
public static String recursiveParseMethodAnnotaion(Method method, Function<Method, String> parseFunc) {
|
||||
public static String recursiveParseMethodAnnotation(Method method, Function<Method, String> parseFunc) {
|
||||
String result = parseFunc.apply(method);
|
||||
if (Objects.isNull(result)) {
|
||||
Class<?> declaringClass = method.getDeclaringClass();
|
||||
|
|
@ -38,9 +38,9 @@ public class ParsePathUtil {
|
|||
return Optional.ofNullable(result).orElse("");
|
||||
}
|
||||
|
||||
private static String recursiveMatches(Class claz, String methodName, Parameter[] parameters,
|
||||
private static String recursiveMatches(Class clazz, String methodName, Parameter[] parameters,
|
||||
Function<Method, String> parseFunc) {
|
||||
Class<?>[] interfaces = claz.getInterfaces();
|
||||
Class<?>[] interfaces = clazz.getInterfaces();
|
||||
for (Class<?> implInterface : interfaces) {
|
||||
String path = recursiveMatches(implInterface, methodName, parameters, parseFunc);
|
||||
if (Objects.nonNull(path)) {
|
||||
|
|
@ -57,7 +57,7 @@ public class ParsePathUtil {
|
|||
}
|
||||
|
||||
private static boolean parameterEquals(Parameter[] p1, Parameter[] p2) {
|
||||
if (p1.length != p1.length) {
|
||||
if (p1.length != p2.length) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < p1.length; i++) {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ import java.lang.reflect.Method;
|
|||
public class RequestMappingMethodInterceptor extends AbstractMethodInterceptor {
|
||||
@Override
|
||||
public String getRequestURL(Method method) {
|
||||
return ParsePathUtil.recursiveParseMethodAnnotaion(method, m -> {
|
||||
return ParsePathUtil.recursiveParseMethodAnnotation(method, m -> {
|
||||
String requestURL = null;
|
||||
RequestMapping methodRequestMapping = AnnotationUtils.getAnnotation(m, RequestMapping.class);
|
||||
if (methodRequestMapping != null) {
|
||||
|
|
@ -47,7 +47,7 @@ public class RequestMappingMethodInterceptor extends AbstractMethodInterceptor {
|
|||
|
||||
@Override
|
||||
public String getAcceptedMethodTypes(Method method) {
|
||||
return ParsePathUtil.recursiveParseMethodAnnotaion(method, m -> {
|
||||
return ParsePathUtil.recursiveParseMethodAnnotation(method, m -> {
|
||||
RequestMapping methodRequestMapping = AnnotationUtils.getAnnotation(m, RequestMapping.class);
|
||||
if (methodRequestMapping == null || methodRequestMapping.method().length == 0) {
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ import java.lang.reflect.Method;
|
|||
public class RestMappingMethodInterceptor extends AbstractMethodInterceptor {
|
||||
@Override
|
||||
public String getRequestURL(Method method) {
|
||||
return ParsePathUtil.recursiveParseMethodAnnotaion(method, m -> {
|
||||
return ParsePathUtil.recursiveParseMethodAnnotation(method, m -> {
|
||||
String requestURL = null;
|
||||
GetMapping getMapping = AnnotationUtils.getAnnotation(m, GetMapping.class);
|
||||
PostMapping postMapping = AnnotationUtils.getAnnotation(m, PostMapping.class);
|
||||
|
|
|
|||
Loading…
Reference in New Issue