From c1a8b9a14dc59419dc4ba1146e0646e9408e83a9 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Tue, 4 Jul 2023 21:24:35 +0200 Subject: [PATCH 1/2] Polishing --- .../messaging/handler/HandlerMethod.java | 19 ++++++------------- .../web/method/HandlerMethod.java | 14 +++++--------- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/spring-messaging/src/main/java/org/springframework/messaging/handler/HandlerMethod.java b/spring-messaging/src/main/java/org/springframework/messaging/handler/HandlerMethod.java index e1efc7aee1..41c5e8403c 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/handler/HandlerMethod.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/handler/HandlerMethod.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -212,7 +212,7 @@ public class HandlerMethod { /** * If the bean method is a bridge method, this method returns the bridged - * (user-defined) method. Otherwise it returns the same method as {@link #getMethod()}. + * (user-defined) method. Otherwise, it returns the same method as {@link #getMethod()}. */ protected Method getBridgedMethod() { return this.bridgedMethod; @@ -297,20 +297,15 @@ public class HandlerMethod { * Return a short representation of this handler method for log message purposes. */ public String getShortLogMessage() { - int args = this.method.getParameterCount(); - return getBeanType().getSimpleName() + "#" + this.method.getName() + "[" + args + " args]"; + return getBeanType().getSimpleName() + "#" + this.method.getName() + + "[" + this.method.getParameterCount() + " args]"; } @Override public boolean equals(@Nullable Object other) { - if (this == other) { - return true; - } - if (!(other instanceof HandlerMethod otherMethod)) { - return false; - } - return (this.bean.equals(otherMethod.bean) && this.method.equals(otherMethod.method)); + return (this == other || (other instanceof HandlerMethod otherMethod && + this.bean.equals(otherMethod.bean) && this.method.equals(otherMethod.method))); } @Override @@ -363,13 +358,11 @@ public class HandlerMethod { } protected String formatInvokeError(String text, Object[] args) { - String formattedArgs = IntStream.range(0, args.length) .mapToObj(i -> (args[i] != null ? "[" + i + "] [type=" + args[i].getClass().getName() + "] [value=" + args[i] + "]" : "[" + i + "] [null]")) .collect(Collectors.joining(",\n", " ", " ")); - return text + "\n" + "Endpoint [" + getBeanType().getName() + "]\n" + "Method [" + getBridgedMethod().toGenericString() + "] " + diff --git a/spring-web/src/main/java/org/springframework/web/method/HandlerMethod.java b/spring-web/src/main/java/org/springframework/web/method/HandlerMethod.java index 6a3c587b13..3a5a1d1aec 100644 --- a/spring-web/src/main/java/org/springframework/web/method/HandlerMethod.java +++ b/spring-web/src/main/java/org/springframework/web/method/HandlerMethod.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -218,6 +218,7 @@ public class HandlerMethod { this.description = handlerMethod.description; } + private MethodParameter[] initMethodParameters() { int count = this.bridgedMethod.getParameterCount(); MethodParameter[] result = new MethodParameter[count]; @@ -248,7 +249,7 @@ public class HandlerMethod { for (Class paramType : method.getParameterTypes()) { joiner.add(paramType.getSimpleName()); } - return beanType.getName() + "#" + method.getName() + joiner.toString(); + return beanType.getName() + "#" + method.getName() + joiner; } @@ -424,13 +425,8 @@ public class HandlerMethod { @Override public boolean equals(@Nullable Object other) { - if (this == other) { - return true; - } - if (!(other instanceof HandlerMethod otherMethod)) { - return false; - } - return (this.bean.equals(otherMethod.bean) && this.method.equals(otherMethod.method)); + return (this == other || (other instanceof HandlerMethod otherMethod && + this.bean.equals(otherMethod.bean) && this.method.equals(otherMethod.method))); } @Override From 23655812658db30c9d450caab6163ede0b81b466 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Tue, 4 Jul 2023 21:35:37 +0200 Subject: [PATCH 2/2] Upgrade to HSQLDB 2.7.2 and WebJars Locator 0.53 --- framework-platform/framework-platform.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework-platform/framework-platform.gradle b/framework-platform/framework-platform.gradle index 041014f7af..5432beee88 100644 --- a/framework-platform/framework-platform.gradle +++ b/framework-platform/framework-platform.gradle @@ -127,7 +127,7 @@ dependencies { api("org.hamcrest:hamcrest:2.2") api("org.hibernate:hibernate-core-jakarta:5.6.15.Final") api("org.hibernate:hibernate-validator:7.0.5.Final") - api("org.hsqldb:hsqldb:2.7.1") + api("org.hsqldb:hsqldb:2.7.2") api("org.javamoney:moneta:1.4.2") api("org.jruby:jruby:9.4.3.0") api("org.junit.support:testng-engine:1.0.4") @@ -141,7 +141,7 @@ dependencies { api("org.slf4j:slf4j-api:2.0.7") api("org.testng:testng:7.8.0") api("org.webjars:underscorejs:1.8.3") - api("org.webjars:webjars-locator-core:0.52") + api("org.webjars:webjars-locator-core:0.53") api("org.xmlunit:xmlunit-assertj:2.9.1") api("org.xmlunit:xmlunit-matchers:2.9.1") api("org.yaml:snakeyaml:1.33")