Merge branch '2.0.x'

pull/13540/head
Andy Wilkinson 7 years ago
commit 24dec4807f

@ -78,15 +78,24 @@ class StaticResourceJars {
throw new IllegalStateException(
"Failed to create File from URL '" + url + "'");
}
catch (IllegalArgumentException ex) {
return null;
}
}
private void addUrl(List<URL> urls, URL url) {
try {
if ("file".equals(url.getProtocol())) {
addUrlFile(urls, url, toFile(url));
if (!"file".equals(url.getProtocol())) {
addUrlConnection(urls, url, url.openConnection());
}
else {
addUrlConnection(urls, url, url.openConnection());
File file = toFile(url);
if (file != null) {
addUrlFile(urls, url, file);
}
else {
addUrlConnection(urls, url, url.openConnection());
}
}
}
catch (IOException ex) {

@ -74,6 +74,14 @@ public class StaticResourceJarsTests {
assertThat(staticResourceJarUrls).hasSize(0);
}
@Test
public void uncPathsAreTolerated() throws Exception {
File jarFile = createResourcesJar("test-resources.jar");
List<URL> staticResourceJarUrls = new StaticResourceJars().getUrlsFrom(
jarFile.toURI().toURL(), new URL("file://unc.example.com/test.jar"));
assertThat(staticResourceJarUrls).hasSize(1);
}
private File createResourcesJar(String name) throws IOException {
return createJar(name, (output) -> {
JarEntry jarEntry = new JarEntry("META-INF/resources");

Loading…
Cancel
Save