mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-26 11:39:14 +00:00
Merge branch '3.4.x' into 3.5.x
Closes gh-46176
This commit is contained in:
+8
@@ -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);
|
||||
|
||||
+7
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user