File tree Expand file tree Collapse file tree 1 file changed +13
-10
lines changed
spring-web/src/main/java/org/springframework/web/util Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Original file line number Diff line number Diff line change 3636 * error stacktrace at TRACE level.
3737 *
3838 * @author Rossen Stoyanchev
39+ * @author Yanming Zhou
3940 * @since 6.1
4041 */
4142public class DisconnectedClientHelper {
@@ -50,16 +51,8 @@ public class DisconnectedClientHelper {
5051 private static final Set <Class <?>> CLIENT_EXCEPTION_TYPES = new HashSet <>(2 );
5152
5253 static {
53- try {
54- ClassLoader classLoader = DisconnectedClientHelper .class .getClassLoader ();
55- CLIENT_EXCEPTION_TYPES .add (ClassUtils .forName (
56- "org.springframework.web.client.RestClientException" , classLoader ));
57- CLIENT_EXCEPTION_TYPES .add (ClassUtils .forName (
58- "org.springframework.web.reactive.function.client.WebClientException" , classLoader ));
59- }
60- catch (ClassNotFoundException ex ) {
61- // ignore
62- }
54+ registerClientExceptionType ("org.springframework.web.client.RestClientException" );
55+ registerClientExceptionType ("org.springframework.web.reactive.function.client.WebClientException" );
6356 }
6457
6558
@@ -135,4 +128,14 @@ public static boolean isClientDisconnectedException(@Nullable Throwable ex) {
135128 return false ;
136129 }
137130
131+ private static void registerClientExceptionType (String type ) {
132+ try {
133+ ClassLoader classLoader = DisconnectedClientHelper .class .getClassLoader ();
134+ CLIENT_EXCEPTION_TYPES .add (ClassUtils .forName (type , classLoader ));
135+ }
136+ catch (ClassNotFoundException ex ) {
137+ // ignore
138+ }
139+ }
140+
138141}
You can’t perform that action at this time.
0 commit comments