Merge branch '1.5.x'

This commit is contained in:
Phillip Webb
2018-04-04 14:51:16 -07:00
7 changed files with 28 additions and 5 deletions

View File

@@ -51,6 +51,7 @@ public abstract class TestJarCreator {
writeNestedEntry("nested.jar", unpackNested, jarOutputStream);
writeNestedEntry("another-nested.jar", unpackNested, jarOutputStream);
writeNestedEntry("space nested.jar", unpackNested, jarOutputStream);
}
}

View File

@@ -108,7 +108,7 @@ public class ExplodedArchiveTests {
@Test
public void getEntries() {
Map<String, Archive.Entry> entries = getEntriesMap(this.archive);
assertThat(entries.size()).isEqualTo(10);
assertThat(entries.size()).isEqualTo(11);
}
@Test

View File

@@ -82,7 +82,7 @@ public class JarFileArchiveTests {
@Test
public void getEntries() {
Map<String, Archive.Entry> entries = getEntriesMap(this.archive);
assertThat(entries.size()).isEqualTo(10);
assertThat(entries.size()).isEqualTo(11);
}
@Test

View File

@@ -81,6 +81,7 @@ public class CentralDirectoryParserTests {
assertThat(headers.next().getName().toString()).isEqualTo("special/\u00EB.dat");
assertThat(headers.next().getName().toString()).isEqualTo("nested.jar");
assertThat(headers.next().getName().toString()).isEqualTo("another-nested.jar");
assertThat(headers.next().getName().toString()).isEqualTo("space nested.jar");
assertThat(headers.hasNext()).isFalse();
}

View File

@@ -93,6 +93,7 @@ public class JarFileTests {
assertThat(entries.nextElement().getName()).isEqualTo("special/\u00EB.dat");
assertThat(entries.nextElement().getName()).isEqualTo("nested.jar");
assertThat(entries.nextElement().getName()).isEqualTo("another-nested.jar");
assertThat(entries.nextElement().getName()).isEqualTo("space nested.jar");
assertThat(entries.hasMoreElements()).isFalse();
URL jarUrl = new URL("jar:" + this.rootJarFile.toURI() + "!/");
URLClassLoader urlClassLoader = new URLClassLoader(new URL[] { jarUrl });
@@ -135,6 +136,7 @@ public class JarFileTests {
assertThat(entries.nextElement().getName()).isEqualTo("special/\u00EB.dat");
assertThat(entries.nextElement().getName()).isEqualTo("nested.jar");
assertThat(entries.nextElement().getName()).isEqualTo("another-nested.jar");
assertThat(entries.nextElement().getName()).isEqualTo("space nested.jar");
assertThat(entries.hasMoreElements()).isFalse();
}

View File

@@ -134,6 +134,21 @@ public class JarURLConnectionTests {
.hasSameContentAs(new ByteArrayInputStream(new byte[] { 3 }));
}
@Test
public void connectionToEntryWithSpaceNestedEntry() throws Exception {
URL url = new URL("jar:file:" + getRelativePath() + "!/space nested.jar!/3.dat");
assertThat(JarURLConnection.get(url, this.jarFile).getInputStream())
.hasSameContentAs(new ByteArrayInputStream(new byte[] { 3 }));
}
@Test
public void connectionToEntryWithEncodedSpaceNestedEntry() throws Exception {
URL url = new URL(
"jar:file:" + getRelativePath() + "!/space%20nested.jar!/3.dat");
assertThat(JarURLConnection.get(url, this.jarFile).getInputStream())
.hasSameContentAs(new ByteArrayInputStream(new byte[] { 3 }));
}
@Test
public void getContentLengthReturnsLengthOfUnderlyingEntry() throws Exception {
URL url = new URL(new URL("jar", null, -1,