Fix Path to URL conversion for windows users (#9989)

* Fix Path to URL conversion for windows users
This commit is contained in:
Joakim Erdfelt 2023-06-28 14:04:21 -05:00 committed by GitHub
parent cc3bac27a5
commit 0863b555dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -88,7 +88,7 @@ public class UrlResourceFactoryTest
{
Path path = MavenTestingUtils.getTestResourcePath("example.jar");
int fileSize = (int)Files.size(path);
URL fileUrl = new URL("file:" + path.toAbsolutePath());
URL fileUrl = path.toUri().toURL();
URLResourceFactory urlResourceFactory = new URLResourceFactory();
Resource resource = urlResourceFactory.newResource(fileUrl);
@ -106,7 +106,7 @@ public class UrlResourceFactoryTest
public void testJarFileUrl() throws Exception
{
Path path = MavenTestingUtils.getTestResourcePath("example.jar");
URL jarFileUrl = new URL("jar:file:" + path.toAbsolutePath() + "!/WEB-INF/web.xml");
URL jarFileUrl = new URL("jar:" + path.toUri().toASCIIString() + "!/WEB-INF/web.xml");
int fileSize = (int)fileSize(jarFileUrl);
URLResourceFactory urlResourceFactory = new URLResourceFactory();
Resource resource = urlResourceFactory.newResource(jarFileUrl);