Merge branch '1.5.x'

This commit is contained in:
Phillip Webb
2018-03-16 14:58:34 -07:00
4 changed files with 58 additions and 7 deletions

View File

@@ -481,4 +481,24 @@ public class JarFileTests {
assertThat(temp.delete()).isTrue();
}
@Test
public void createUrlFromStringWithContextWhenNotFound() throws Exception {
// gh-12483
JarURLConnection.setUseFastExceptions(true);
try {
JarFile.registerUrlProtocolHandler();
JarFile nested = this.jarFile
.getNestedJarFile(this.jarFile.getEntry("nested.jar"));
URL context = nested.getUrl();
new URL(context, "jar:" + this.rootJarFile.toURI() + "!/nested.jar!/3.dat")
.openConnection().getInputStream().close();
this.thrown.expect(FileNotFoundException.class);
new URL(context, "jar:" + this.rootJarFile.toURI() + "!/no.dat")
.openConnection().getInputStream().close();
}
finally {
JarURLConnection.setUseFastExceptions(false);
}
}
}