Merge branch '3.1.x'

Closes gh-38168
This commit is contained in:
Andy Wilkinson
2023-11-01 15:04:53 +00:00
15 changed files with 23 additions and 23 deletions

View File

@@ -41,7 +41,7 @@ final class Canonicalizer {
static String canonicalize(String path) {
path = removeEmbeddedSlashDotDotSlash(path);
path = removedEmbdeddedSlashDotSlash(path);
path = removeEmbeddedSlashDotSlash(path);
path = removeTrailingSlashDotDot(path);
path = removeTrailingSlashDot(path);
return path;
@@ -57,7 +57,7 @@ final class Canonicalizer {
return path;
}
private static String removedEmbdeddedSlashDotSlash(String path) {
private static String removeEmbeddedSlashDotSlash(String path) {
int index;
while ((index = path.indexOf("/./")) >= 0) {
String before = path.substring(0, index);

View File

@@ -242,7 +242,7 @@ class NestedJarFileTests {
}
@Test
void sizeWhenClosedThowsException() throws Exception {
void sizeWhenClosedThrowsException() throws Exception {
try (NestedJarFile jar = new NestedJarFile(this.file)) {
jar.close();
assertThatIllegalStateException().isThrownBy(() -> jar.size()).withMessage("Zip file closed");
@@ -347,7 +347,7 @@ class NestedJarFileTests {
}
@Test
void streamStreamsEnties() throws IOException {
void streamStreamsEntries() throws IOException {
try (NestedJarFile jar = new NestedJarFile(this.file, "multi-release.jar")) {
assertThat(jar.stream().map((entry) -> entry.getName() + ":" + entry.getRealName())).containsExactly(
"META-INF/:META-INF/", "META-INF/MANIFEST.MF:META-INF/MANIFEST.MF",

View File

@@ -55,7 +55,7 @@ class SecurityInfoTests {
}
@Test
void getWhenHasSignatureFileButNoSecuityMaterialReturnsNone() throws Exception {
void getWhenHasSignatureFileButNoSecurityMaterialReturnsNone() throws Exception {
File file = new File(this.temp, "test.jar");
TestJar.create(file, false, true);
try (ZipContent content = ZipContent.open(file.toPath())) {

View File

@@ -80,7 +80,7 @@ class JarFileArchiveTests {
}
@Test
void getClassPathUrlsWhenNoPredicartesReturnsUrls() throws Exception {
void getClassPathUrlsWhenNoPredicatesReturnsUrls() throws Exception {
Set<URL> urls = this.archive.getClassPathUrls(Archive.ALL_ENTRIES);
URL[] expected = TestJar.expectedEntries()
.stream()

View File

@@ -35,12 +35,12 @@ class CanonicalizerTests {
}
@Test
void canonicalizeWhenHasEmbdeddSlashDotDotSlash() {
void canonicalizeWhenHasEmbeddedSlashDotDotSlash() {
assertThat(Canonicalizer.canonicalize("/foo/../bar/bif/bam/../../baz")).isEqualTo("/bar/baz");
}
@Test
void canonicalizeWhenHasEmbdeddSlashDotSlash() {
void canonicalizeWhenHasEmbeddedSlashDotSlash() {
assertThat(Canonicalizer.canonicalize("/foo/./bar/bif/bam/././baz")).isEqualTo("/foo/bar/bif/bam/baz");
}

View File

@@ -255,7 +255,7 @@ class JarUrlConnectionTests {
}
@Test
void getInputStreamWhenNoEntryAndOptimzedThrowsException() throws Exception {
void getInputStreamWhenNoEntryAndOptimizedThrowsException() throws Exception {
JarUrlConnection setupConnection = JarUrlConnection.open(JarUrl.create(this.file, "nested.jar"));
setupConnection.connect();
assertThat(JarUrlConnection.jarFiles.getCached(setupConnection.getJarFileURL())).isNotNull();
@@ -266,7 +266,7 @@ class JarUrlConnectionTests {
}
@Test
void getInputStreamWhenNoEntryAndNotOptimzedThrowsException() throws Exception {
void getInputStreamWhenNoEntryAndNotOptimizedThrowsException() throws Exception {
JarUrlConnection connection = JarUrlConnection.open(JarUrl.create(this.file, "nested.jar", "missing.dat"));
assertThatExceptionOfType(FileNotFoundException.class).isThrownBy(connection::getInputStream)
.withMessageContaining("JAR entry missing.dat not found in");
@@ -475,7 +475,7 @@ class JarUrlConnectionTests {
}
@Test
void openWhenNestedAndInCachedWithoutEntryAndOptimzationsEnabledReturnsNoFoundConnection() throws Exception {
void openWhenNestedAndInCachedWithoutEntryAndOptimizationsEnabledReturnsNoFoundConnection() throws Exception {
JarUrlConnection setupConnection = JarUrlConnection.open(JarUrl.create(this.file, "nested.jar"));
setupConnection.connect();
assertThat(JarUrlConnection.jarFiles.getCached(setupConnection.getJarFileURL())).isNotNull();

View File

@@ -58,7 +58,7 @@ class UrlJarManifestTests {
}
@Test
void getEntrtyAttributesWhenSuppliedManifestIsNullReturnsNull() throws Exception {
void getEntryAttributesWhenSuppliedManifestIsNullReturnsNull() throws Exception {
UrlJarManifest urlJarManifest = new UrlJarManifest(() -> null);
assertThat(urlJarManifest.getEntryAttributes(new JarEntry("test"))).isNull();
}

View File

@@ -82,7 +82,7 @@ class NestedLocationTests {
}
@Test
void fromUrlWhenNoSeparatorThrowsExceptiuon() {
void fromUrlWhenNoSeparatorThrowsException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> NestedLocation.fromUrl(new URL("nested:test.jar!nested.jar")))
.withMessageContaining("'path' must contain '/!'");
@@ -110,7 +110,7 @@ class NestedLocationTests {
}
@Test
void fromUriWhenNoSeparatorThrowsExceptiuon() {
void fromUriWhenNoSeparatorThrowsException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> NestedLocation.fromUri(new URI("nested:test.jar!nested.jar")))
.withMessageContaining("'path' must contain '/!'");

View File

@@ -65,7 +65,7 @@ class NestedByteChannelTests {
}
@AfterEach
void cleanuo() throws Exception {
void cleanup() throws Exception {
this.channel.close();
}

View File

@@ -78,7 +78,7 @@ class NestedPathTests {
}
@Test
void isAbsoluteRerturnsTrue() {
void isAbsoluteReturnsTrue() {
assertThat(this.path.isAbsolute()).isTrue();
}

View File

@@ -96,7 +96,7 @@ class DataBlockInputStreamTests {
}
@Test
void skipBackwardsPastBeginingSkipsBytes() throws Exception {
void skipBackwardsPastBeginningSkipsBytes() throws Exception {
assertThat(this.inputStream.skip(1)).isEqualTo(1);
assertThat(this.inputStream.skip(-100)).isEqualTo(-1);
assertThat(this.inputStream.read()).isEqualTo(0);