Merge branch '3.2.x'

Closes gh-39121
This commit is contained in:
Andy Wilkinson
2024-01-12 16:25:13 +00:00
2 changed files with 22 additions and 4 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
package org.springframework.boot.loader.net.protocol.nested;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.nio.file.Path;
@@ -24,6 +25,8 @@ import java.nio.file.Path;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledOnOs;
import org.junit.jupiter.api.condition.OS;
import org.junit.jupiter.api.io.TempDir;
import org.springframework.boot.loader.net.protocol.Handlers;
@@ -35,6 +38,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
* Tests for {@link NestedLocation}.
*
* @author Phillip Webb
* @author Andy Wilkinson
*/
class NestedLocationTests {
@@ -130,4 +134,13 @@ class NestedLocationTests {
assertThat(location.nestedEntryName()).isEqualTo("lib/nested.jar");
}
@Test
@EnabledOnOs(OS.WINDOWS)
void windowsUncPathIsHandledCorrectly() throws MalformedURLException {
NestedLocation location = NestedLocation.fromUrl(
new URL("nested://localhost/c$/dev/temp/demo/build/libs/demo-0.0.1-SNAPSHOT.jar/!BOOT-INF/classes/"));
assertThat(location.path()).asString()
.isEqualTo("\\\\localhost\\c$\\dev\\temp\\demo\\build\\libs\\demo-0.0.1-SNAPSHOT.jar");
}
}