Skip to content

Commit 825fc2f

Browse files
author
Dave Syer
committed
Omit jar: prefix from jarFileUrl
1 parent ed15345 commit 825fc2f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarURLConnection.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ protected JarURLConnection(URL url, JarFile jarFile) throws MalformedURLExceptio
6363
* sensible for #getJarFileURL().
6464
*/
6565
if (separator + SEPARATOR.length() != spec.length()) {
66-
this.jarFileUrl = new URL("jar:" + spec);
66+
this.jarFileUrl = new URL(spec);
6767
this.jarEntryName = spec.substring(separator + 2);
6868
}
6969
else {
7070
// The root of the archive (!/)
71-
this.jarFileUrl = new URL("jar:" + spec.substring(0, separator));
71+
this.jarFileUrl = new URL(spec.substring(0, separator));
7272
}
7373
}
7474

spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/JarFileTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public void getUrl() throws Exception {
150150
assertThat(jarURLConnection.getContentLength(), greaterThan(1));
151151
assertThat(jarURLConnection.getContent(), sameInstance((Object) this.jarFile));
152152
assertThat(jarURLConnection.getContentType(), equalTo("x-java/jar"));
153-
assertThat(jarURLConnection.getJarFileURL().toString(), equalTo("jar:file:"
153+
assertThat(jarURLConnection.getJarFileURL().toString(), equalTo("file:"
154154
+ this.rootJarFile));
155155
}
156156

@@ -216,8 +216,8 @@ public void getNestedJarFile() throws Exception {
216216
+ "!/nested.jar!/"));
217217
JarURLConnection conn = (JarURLConnection) url.openConnection();
218218
assertThat(conn.getJarFile(), sameInstance(nestedJarFile));
219-
assertThat(conn.getJarFileURL().toString(), equalTo("jar:file:"
220-
+ this.rootJarFile.getPath() + "!/nested.jar"));
219+
assertThat(conn.getJarFileURL().toString(),
220+
equalTo("file:" + this.rootJarFile.getPath() + "!/nested.jar"));
221221
}
222222

223223
@Test

0 commit comments

Comments
 (0)