Omit jar: prefix from jarFileUrl

pull/382/head
Dave Syer 11 years ago
parent ed15345df1
commit 825fc2f7df

@ -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));
}
}

@ -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

Loading…
Cancel
Save