Current directory (lodaer.path=.) pathology workaround

It turns out that loader.path=. was pathological and before this
change ended up making the classpath empty (loader.path=.,lib/
would have fixed it). With this change the old behaviour is still
supported, but if the only user-supplied path entry is "." (or
empty) then it is now kept, and translates into the root of the
current archive if running as "java -jar ...".

Fixes gh-270
This commit is contained in:
Dave Syer
2014-02-25 10:44:33 +00:00
parent 083cb388c0
commit f0f73a4ead
4 changed files with 22 additions and 9 deletions

View File

@@ -83,7 +83,14 @@ public class PropertiesLauncherTests {
}
@Test
public void testUserSpecifiedPath() throws Exception {
public void testUserSpecifiedDotPath() throws Exception {
System.setProperty("loader.path", ".");
PropertiesLauncher launcher = new PropertiesLauncher();
assertEquals("[.]", ReflectionTestUtils.getField(launcher, "paths").toString());
}
@Test
public void testUserSpecifiedWildcardPath() throws Exception {
System.setProperty("loader.path", "jars/*");
System.setProperty("loader.main", "demo.Application");
PropertiesLauncher launcher = new PropertiesLauncher();