Merge branch '3.4.x' into 3.5.x

Closes gh-46176
This commit is contained in:
Phillip Webb
2025-06-23 10:37:30 -07:00
2 changed files with 15 additions and 0 deletions
@@ -17,6 +17,7 @@
package org.springframework.boot.loader.net.protocol.nested;
import java.io.IOException;
import java.net.InetAddress;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;
@@ -35,6 +36,13 @@ public class Handler extends URLStreamHandler {
private static final String PREFIX = "nested:";
@Override
protected InetAddress getHostAddress(URL url) {
// Some Windows users have reported that calls to java.net.URL.getHostAddress()
// can be slow. Since we only deal with local files we always return null here.
return null;
}
@Override
protected URLConnection openConnection(URL url) throws IOException {
return new NestedUrlConnection(url);
@@ -68,4 +68,11 @@ class HandlerTests {
assertThatNoException().isThrownBy(() -> Handler.assertUrlIsNotMalformed(url));
}
@Test
void getHostAddressIsNull() throws Exception {
// gh-46063
String url = "nested:" + this.temp.getAbsolutePath() + "/!nested.jar";
assertThat(new Handler().getHostAddress(new URL(url))).isNull();
}
}