Merge branch '3.4.x'

This commit is contained in:
Stéphane Nicoll 2025-01-11 13:11:45 +01:00
commit cc49b3061f
2 changed files with 6 additions and 34 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2024 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,7 +16,6 @@
package org.springframework.boot.build.bom; package org.springframework.boot.build.bom;
import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
@ -31,9 +30,8 @@ import org.gradle.internal.impldep.org.apache.http.client.config.CookieSpecs;
import org.springframework.http.HttpMethod; import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.web.client.DefaultResponseErrorHandler; import org.springframework.web.client.NoOpResponseErrorHandler;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
/** /**
@ -57,7 +55,7 @@ public abstract class CheckLinks extends DefaultTask {
CloseableHttpClient httpClient = HttpClients.custom().setDefaultRequestConfig(config).build(); CloseableHttpClient httpClient = HttpClients.custom().setDefaultRequestConfig(config).build();
HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(httpClient); HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(httpClient);
RestTemplate restTemplate = new RestTemplate(requestFactory); RestTemplate restTemplate = new RestTemplate(requestFactory);
restTemplate.setErrorHandler(new IgnoringErrorHandler()); restTemplate.setErrorHandler(new NoOpResponseErrorHandler());
for (Library library : this.bom.getLibraries()) { for (Library library : this.bom.getLibraries()) {
library.getLinks().forEach((name, links) -> links.forEach((link) -> { library.getLinks().forEach((name, links) -> links.forEach((link) -> {
URI uri; URI uri;
@ -74,12 +72,4 @@ public abstract class CheckLinks extends DefaultTask {
} }
} }
static class IgnoringErrorHandler extends DefaultResponseErrorHandler {
@Override
public void handleError(ClientHttpResponse response) throws IOException {
}
}
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2024 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -44,12 +44,10 @@ import org.junit.jupiter.api.extension.TestTemplateInvocationContextProvider;
import org.junit.platform.commons.util.ReflectionUtils; import org.junit.platform.commons.util.ReflectionUtils;
import org.springframework.boot.testsupport.BuildOutput; import org.springframework.boot.testsupport.BuildOutput;
import org.springframework.http.HttpMethod;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.util.FileSystemUtils; import org.springframework.util.FileSystemUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.client.ResponseErrorHandler; import org.springframework.web.client.NoOpResponseErrorHandler;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriTemplateHandler; import org.springframework.web.util.UriTemplateHandler;
@ -188,23 +186,7 @@ class EmbeddedServerContainerInvocationContextProvider
RestTemplate rest = new RestTemplate(new HttpComponentsClientHttpRequestFactory(HttpClients.custom() RestTemplate rest = new RestTemplate(new HttpComponentsClientHttpRequestFactory(HttpClients.custom()
.setRetryStrategy(new DefaultHttpRequestRetryStrategy(10, TimeValue.of(1, TimeUnit.SECONDS))) .setRetryStrategy(new DefaultHttpRequestRetryStrategy(10, TimeValue.of(1, TimeUnit.SECONDS)))
.build())); .build()));
rest.setErrorHandler(new ResponseErrorHandler() { rest.setErrorHandler(new NoOpResponseErrorHandler());
@Override
public boolean hasError(ClientHttpResponse response) throws IOException {
return false;
}
@Override
@SuppressWarnings("removal")
public void handleError(ClientHttpResponse response) throws IOException {
}
@Override
public void handleError(URI url, HttpMethod method, ClientHttpResponse response) throws IOException {
}
});
rest.setUriTemplateHandler(new UriTemplateHandler() { rest.setUriTemplateHandler(new UriTemplateHandler() {
@Override @Override