Commit 56396857 authored by Andy Wilkinson's avatar Andy Wilkinson

Polish "Prefer file: to jar:file: URLs in launcher"

See gh-16248
parent c1b34d03
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -117,7 +117,7 @@ public class ExplodedArchive implements Archive { ...@@ -117,7 +117,7 @@ public class ExplodedArchive implements Archive {
protected Archive getNestedArchive(Entry entry) throws IOException { protected Archive getNestedArchive(Entry entry) throws IOException {
File file = ((FileEntry) entry).getFile(); File file = ((FileEntry) entry).getFile();
return (file.isDirectory() ? new ExplodedArchive(file) return (file.isDirectory() ? new ExplodedArchive(file)
: new JarFileArchive(file, file.toURI().toURL())); : new JarFileArchive(file));
} }
@Override @Override
......
/* /*
* Copyright 2012-2018 the original author or authors. * Copyright 2012-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -53,7 +53,7 @@ public class JarFileArchive implements Archive { ...@@ -53,7 +53,7 @@ public class JarFileArchive implements Archive {
private File tempUnpackFolder; private File tempUnpackFolder;
public JarFileArchive(File file) throws IOException { public JarFileArchive(File file) throws IOException {
this(file, null); this(file, file.toURI().toURL());
} }
public JarFileArchive(File file, URL url) throws IOException { public JarFileArchive(File file, URL url) throws IOException {
......
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2018 the original author or authors. * Copyright 2012-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -176,7 +176,7 @@ public class PropertiesLauncherTests { ...@@ -176,7 +176,7 @@ public class PropertiesLauncherTests {
.isEqualTo("[jar:file:./src/test/resources/nested-jars/app.jar!/]"); .isEqualTo("[jar:file:./src/test/resources/nested-jars/app.jar!/]");
List<Archive> archives = launcher.getClassPathArchives(); List<Archive> archives = launcher.getClassPathArchives();
assertThat(archives).areExactly(1, endingWith("foo.jar!/")); assertThat(archives).areExactly(1, endingWith("foo.jar!/"));
assertThat(archives).areExactly(1, endingWith("app.jar!/")); assertThat(archives).areExactly(1, endingWith("app.jar"));
} }
@Test @Test
...@@ -185,7 +185,7 @@ public class PropertiesLauncherTests { ...@@ -185,7 +185,7 @@ public class PropertiesLauncherTests {
PropertiesLauncher launcher = new PropertiesLauncher(); PropertiesLauncher launcher = new PropertiesLauncher();
List<Archive> archives = launcher.getClassPathArchives(); List<Archive> archives = launcher.getClassPathArchives();
assertThat(archives).areExactly(1, endingWith("foo.jar!/")); assertThat(archives).areExactly(1, endingWith("foo.jar!/"));
assertThat(archives).areExactly(1, endingWith("app.jar!/")); assertThat(archives).areExactly(1, endingWith("app.jar"));
} }
@Test @Test
...@@ -204,7 +204,7 @@ public class PropertiesLauncherTests { ...@@ -204,7 +204,7 @@ public class PropertiesLauncherTests {
PropertiesLauncher launcher = new PropertiesLauncher(); PropertiesLauncher launcher = new PropertiesLauncher();
List<Archive> archives = launcher.getClassPathArchives(); List<Archive> archives = launcher.getClassPathArchives();
assertThat(archives).areExactly(1, endingWith("foo.jar!/")); assertThat(archives).areExactly(1, endingWith("foo.jar!/"));
assertThat(archives).areExactly(1, endingWith("app.jar!/")); assertThat(archives).areExactly(1, endingWith("app.jar"));
} }
@Test @Test
......
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2018 the original author or authors. * Copyright 2012-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -84,7 +84,7 @@ public class JarFileArchiveTests { ...@@ -84,7 +84,7 @@ public class JarFileArchiveTests {
@Test @Test
public void getUrl() throws Exception { public void getUrl() throws Exception {
URL url = this.archive.getUrl(); URL url = this.archive.getUrl();
assertThat(url.toString()).isEqualTo("jar:" + this.rootJarFileUrl + "!/"); assertThat(url.toString()).isEqualTo(this.rootJarFileUrl);
} }
@Test @Test
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment