Decode file: URLs passed into PropertiesLauncher via loader.path

Closes gh-12325
This commit is contained in:
Andy Wilkinson
2018-03-05 11:51:02 +00:00
parent 4e3d0f5b33
commit eee891dbc8
2 changed files with 25 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@@ -336,6 +336,17 @@ public class PropertiesLauncherTests {
assertThat(launcher.getMainClass()).isEqualTo("demo.FooApplication");
}
@Test
public void encodedFileUrlLoaderPathIsHandledCorrectly() throws Exception {
File loaderPath = this.temporaryFolder.newFolder("loader path");
System.setProperty("loader.path", loaderPath.toURI().toURL().toString());
PropertiesLauncher launcher = new PropertiesLauncher();
List<Archive> archives = launcher.getClassPathArchives();
assertThat(archives.size()).isEqualTo(1);
File archiveRoot = (File) ReflectionTestUtils.getField(archives.get(0), "root");
assertThat(archiveRoot).isEqualTo(loaderPath);
}
private void waitFor(String value) throws Exception {
int count = 0;
boolean timeout = false;