Fix ParsePathUtil#parameterEquals method ArrayIndexOutOfBoundsException error and some typo (#5216)

This commit is contained in:
yangy 2020-08-01 16:16:57 +08:00 committed by GitHub
parent 4f011585ee
commit 118e334e7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 deletions

View File

@ -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++) {

View File

@ -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;

View File

@ -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);