Omit jar: prefix from jarFileUrl

This commit is contained in:
Dave Syer 2014-02-19 13:59:05 +00:00
parent ed15345df1
commit 825fc2f7df
2 changed files with 5 additions and 5 deletions

View File

@ -63,12 +63,12 @@ class JarURLConnection extends java.net.JarURLConnection {
* sensible for #getJarFileURL().
*/
if (separator + SEPARATOR.length() != spec.length()) {
this.jarFileUrl = new URL("jar:" + spec);
this.jarFileUrl = new URL(spec);
this.jarEntryName = spec.substring(separator + 2);
}
else {
// The root of the archive (!/)
this.jarFileUrl = new URL("jar:" + spec.substring(0, separator));
this.jarFileUrl = new URL(spec.substring(0, separator));
}
}

View File

@ -150,7 +150,7 @@ public class JarFileTests {
assertThat(jarURLConnection.getContentLength(), greaterThan(1));
assertThat(jarURLConnection.getContent(), sameInstance((Object) this.jarFile));
assertThat(jarURLConnection.getContentType(), equalTo("x-java/jar"));
assertThat(jarURLConnection.getJarFileURL().toString(), equalTo("jar:file:"
assertThat(jarURLConnection.getJarFileURL().toString(), equalTo("file:"
+ this.rootJarFile));
}
@ -216,8 +216,8 @@ public class JarFileTests {
+ "!/nested.jar!/"));
JarURLConnection conn = (JarURLConnection) url.openConnection();
assertThat(conn.getJarFile(), sameInstance(nestedJarFile));
assertThat(conn.getJarFileURL().toString(), equalTo("jar:file:"
+ this.rootJarFile.getPath() + "!/nested.jar"));
assertThat(conn.getJarFileURL().toString(),
equalTo("file:" + this.rootJarFile.getPath() + "!/nested.jar"));
}
@Test